I am working on a project where I need to enter comma separated values in a database field and then extract the data to use in if and else statement.
For example: in the database field user_status
i have usernames like admin,admin1,admin2,admin3........etc
. I want to use these values like:
$user_status = $row['user_status']; // database values of all the usernames
$username = $_SESSION['username']; // username of the logged in user eg. admin
if($user_status == $username) // if session username matches with a username in the database field
{
statements;
}else{
statements;
}
I want to extract the comma separated database values from the database and match if the logged in user's username matches with one of many username's in the database. But I am not pretty sure how to do this. Please help me experts.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…