StirCrazy Posted April 22, 2006 Share Posted April 22, 2006 Wonder if someone can help me:I already have a login script fully working and have decided to add a banning function.I want to add to the login code... something along these lines:$r = my_query("select hold from users where hold='y'");[b]if user is hold='y' then Location: banned.php[/b]Sorry, find it hard to explain ~ Can anyone help with the proper syntax?Kind Regards,S.C>[b]Table name: Users | Column: hold | enum ('y','n')[/b] Link to comment https://forums.phpfreaks.com/topic/8125-solved-r-my_queryselect-hold-from-users-where-holdy/ Share on other sites More sharing options...
wildteen88 Posted April 22, 2006 Share Posted April 22, 2006 Do this:[code]$sql = "SELECT * FROM users";$query = mysql_query($sql) or die("MySQL Error: " . $query . " : " . mysql_error());$user = mysql_fetch_array($query);if($user['hold'] == "Y"){ header("Location: banned.php");}//continue login process or what ever here as user is not banned.[/code] Link to comment https://forums.phpfreaks.com/topic/8125-solved-r-my_queryselect-hold-from-users-where-holdy/#findComment-29619 Share on other sites More sharing options...
Barand Posted April 23, 2006 Share Posted April 23, 2006 You need to check the "hold" value for a specific user using something like[code].. WHERE userid = '$user'"[/code]In the code above, if the first record in the table has a value of "y" then everyone gets sent to banned.php. Link to comment https://forums.phpfreaks.com/topic/8125-solved-r-my_queryselect-hold-from-users-where-holdy/#findComment-29772 Share on other sites More sharing options...
StirCrazy Posted April 30, 2006 Author Share Posted April 30, 2006 sorry I didn't thank you before for your help - had a play using the info above and managed to get it to work.Thank you guys.S.C> Link to comment https://forums.phpfreaks.com/topic/8125-solved-r-my_queryselect-hold-from-users-where-holdy/#findComment-32156 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.