Jump to content

how do i (if) out a querry


just me and php

Recommended Posts

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 sensitive
if(in_array(strtolower($username)) {
//not post
}
else {
//mysql query to insert post
}
[/code]
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
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.