just me and php Posted December 31, 2006 Share Posted December 31, 2006 im trying to not let some users not to post anything with out banning themand i tryed this but didnt work[code]$f1000= $query = "SELECT * FROM forum ";[/code][code]if($row[Username]=='tom tom','tommy tommy','carol'){$f1000='';}[/code]or am i going to this all wrong? Link to comment https://forums.phpfreaks.com/topic/32358-how-do-i-if-out-a-querry/ Share on other sites More sharing options...
corbin Posted December 31, 2006 Share Posted December 31, 2006 So are users posting abusive messages and you are trying to stop that? Or what are you trying to do? What you asked doesnt make sense... Link to comment https://forums.phpfreaks.com/topic/32358-how-do-i-if-out-a-querry/#findComment-150260 Share on other sites More sharing options...
just me and php Posted December 31, 2006 Author Share Posted December 31, 2006 no im trying to stop some users from posting, but i donot want to ban them from siteso i thought i could just use a ( if ) comand in script that would stop all there postings. Link to comment https://forums.phpfreaks.com/topic/32358-how-do-i-if-out-a-querry/#findComment-150263 Share on other sites More sharing options...
corbin Posted December 31, 2006 Share Posted December 31, 2006 You could create another column in the users table that would probably be the easiest way if it's a lot of people, or you could just use (assume $username is the user's name)[code=php:0]$noposts = array("corbin", "user2", "user3", "thisdudecantpost", "so on i think you get the point");//make sure to put them lower case since this will be case sensitiveif(in_array(strtolower($username)) {//not post} else {//mysql query to insert post}[/code] Link to comment https://forums.phpfreaks.com/topic/32358-how-do-i-if-out-a-querry/#findComment-150269 Share on other sites More sharing options...
JasonLewis Posted December 31, 2006 Share Posted December 31, 2006 um, in_array takes 2 parameters. the string you want to check and the array.[code=php:0]$banned_users = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `banned`='1'"));if(in_array($username, $banned_users)){echo "Sorry, you cannot post because your banned.";}else{//show post form} Link to comment https://forums.phpfreaks.com/topic/32358-how-do-i-if-out-a-querry/#findComment-150287 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.