Page 1 of 1

mysql statements...solved

Posted: Tue Sep 01, 2009 7:02 pm
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);
}

Re: need assistance mysql statements..solved

Posted: Sat Sep 05, 2009 2:18 pm
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.