mysql statements...solved

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
scarface222
Forum Contributor
Posts: 354
Joined: Thu Mar 26, 2009 8:16 pm

mysql statements...solved

Post by scarface222 »

Hey guys I just have a mysql statement

Code: Select all

 
$newuser="SELECT DISTINCT user FROM table WHERE td='$td'";
$query=mysql_query($newuser)
while ($row = mysql_fetch_assoc($query)) {
 $username=' '.$row['user'];
 
;

that results in two entries beside eachother when I echo $username.
I need to create another statement that individually handles each entry. My goal is to be able to check the database for the next available user online so I can replace it in the database. I have a count if one of the users is online but will this even work the way I want it to? Any help greatly appreciated?

continued...

Code: Select all

$check="SELECT * FROM active_users WHERE username='$username'";
$query4=mysql_query($hostcheck3);
$count = mysql_num_rows($query4);
}
Last edited by scarface222 on Sun Sep 06, 2009 1:03 am, edited 1 time in total.
scarface222
Forum Contributor
Posts: 354
Joined: Thu Mar 26, 2009 8:16 pm

Re: need assistance mysql statements..solved

Post by scarface222 »

thanks for the response man, I was making a major noob mistake. I thought that the best thing was to query for multiple entries and somehow make the next statement handle multiple results but what I did was query for a minimum value and then have the php basically loop and delete values that were unnecessary until the right value is reached that is under active users.
Post Reply