Current location: Hot Scripts Forums » Programming Languages » PHP » Stuck on SQL Statement


Stuck on SQL Statement

Reply
  #1 (permalink)  
Old 04-19-09, 02:18 PM
Kev0121 Kev0121 is offline
Newbie Coder
 
Join Date: Dec 2008
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Stuck on SQL Statement

Well in my database in my users table i have a field called 'active' and when users are logged in it changes to 1. What im trying to do is write a sql statement that says check if the user id of $_SESSION['uid'] if their active field is set to 1, if so echo out "Online" if that makes sense? sorry lol didnt know how to describe.

something like this...
PHP Code:

$sql "SELECT active FROM users WHERE active = 1 AND  id = ' " $_SESSION['uid'] . " ' "
Thanks

/Kev
Reply With Quote
  #2 (permalink)  
Old 04-19-09, 02:24 PM
Facundo Facundo is offline
Wannabe Coder
 
Join Date: Apr 2009
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
So, let me understand and then I'll tell you.

You want something like when the user is online, display some text saying ONLINE in his/her profile and if the user is offline display OFFLINE. Don't you?

Or you want a page to show all the online users?
Reply With Quote
  #3 (permalink)  
Old 04-19-09, 02:29 PM
Kev0121 Kev0121 is offline
Newbie Coder
 
Join Date: Dec 2008
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Dont matter i fixed it lol i was looking for

PHP Code:


$sql 
=  "SELECT id FROM users WHERE id = '".$_SESSION['uid']."' AND active = 1"
thanks anyway =]
Reply With Quote
  #4 (permalink)  
Old 04-19-09, 02:30 PM
Facundo Facundo is offline
Wannabe Coder
 
Join Date: Apr 2009
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Ok, no problem.
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
[SOLVED] SQL statement with array? hakeem PHP 4 10-31-08 10:17 PM
SQL Statement select everything that is true? minority ASP 9 07-20-05 07:32 AM
SQL Statement Ajtessin ASP 2 03-26-04 04:02 AM
Help with ASP & FORMS blessedrub ASP 0 01-23-04 10:22 AM
change my field in this example sal21 ASP 3 07-14-03 02:49 AM


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