Current location: Hot Scripts Forums » Programming Languages » PHP » How to see if 'yes' is in a field of a mysql table?


How to see if 'yes' is in a field of a mysql table?

Reply
  #1 (permalink)  
Old 11-07-03, 08:32 PM
x2z x2z is offline
New Member
 
Join Date: Oct 2003
Location: Tennessee
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
How to see if 'yes' is in a field of a mysql table?

ok im trying to make an admin area, and i have
id, admin, banned, aim, email, site, icq, username, password on the table users. i want to do an if function if possible to see if the text 'yes' is in admin of the user that is logged in ($username_x2z) if so, display the admin options, otherwise display the normal user options

Thanks
Reply With Quote
  #2 (permalink)  
Old 11-08-03, 02:54 AM
Stefan's Avatar
Stefan Stefan is offline
Junior Code Guru
 
Join Date: Jun 2003
Location: Utrecht, The Netherlands
Posts: 599
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by x2z
ok im trying to make an admin area, and i have
id, admin, banned, aim, email, site, icq, username, password on the table users. i want to do an if function if possible to see if the text 'yes' is in admin of the user that is logged in ($username_x2z) if so, display the admin options, otherwise display the normal user options

Thanks
well, I take it that you have used a query SELECT * FROM users WHERE username='$username_x2z' to get the information into an array? if not, then you should do that

when you've done that and have used mysql_fetch_array() to get the information into an array, you can simply check the admin field in that array:

Code:
if($array['admin']=="yes") {
// do admin stuff here
}
that should work
Reply With Quote
  #3 (permalink)  
Old 11-08-03, 08:25 AM
x2z x2z is offline
New Member
 
Join Date: Oct 2003
Location: Tennessee
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks. I am not at home at the moment, but when I get there I will try this.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 02:22 AM
PHP to MySQL script question...(using a field to update info in MySQL) DisneyFan25863 PHP 4 11-02-03 03:31 AM
Autonum in mysql table pk_jsp PHP 1 10-11-03 04:32 PM
great product for dumping/recovering MySQL databases Dave Brown General Advertisements 1 10-03-03 07:40 AM
moving data from table to table ..please help! geneane ASP 2 09-22-03 07:02 PM


All times are GMT -5. The time now is 05:40 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.