don11 Posted January 15, 2011 Share Posted January 15, 2011 I created a field in "b_users" table as "banned" with default value="no". i.e, all members by default are set to "banned"="no". I was testing this code in my some pages to ban member and prevent access to my pages: $getid="SELECT * from b_users where id='$user_id'"; if($getid[banned]=="yes") { die("<center>You have been banned from posting</center>"); } else { show page Above code is banning all members. But i want to show ban message to members who's "banned" field value is set to "yes" only. How to do that? Link to comment https://forums.phpfreaks.com/topic/224517-how-to-ban-members/ Share on other sites More sharing options...
President Obama Posted January 15, 2011 Share Posted January 15, 2011 What makes $user_id? Link to comment https://forums.phpfreaks.com/topic/224517-how-to-ban-members/#findComment-1159745 Share on other sites More sharing options...
don11 Posted January 15, 2011 Author Share Posted January 15, 2011 What makes $user_id? It is a id of user as logged in! Link to comment https://forums.phpfreaks.com/topic/224517-how-to-ban-members/#findComment-1159752 Share on other sites More sharing options...
PFMaBiSmAd Posted January 15, 2011 Share Posted January 15, 2011 Your code isn't executing the query or fetching any data from the result set returned by the query, so it will be a little hard for your code to do anything. Link to comment https://forums.phpfreaks.com/topic/224517-how-to-ban-members/#findComment-1159755 Share on other sites More sharing options...
don11 Posted January 15, 2011 Author Share Posted January 15, 2011 How will you code if you have to do that? sample plz Link to comment https://forums.phpfreaks.com/topic/224517-how-to-ban-members/#findComment-1159757 Share on other sites More sharing options...
PFMaBiSmAd Posted January 15, 2011 Share Posted January 15, 2011 You are missing the basic information you need to know before you attempt to do this with your data. You are gong to need to read a basic php/mysql book/tutorial. http://w3schools.com/ has some basic php/mysql tutorials. Link to comment https://forums.phpfreaks.com/topic/224517-how-to-ban-members/#findComment-1159771 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.