While() will skip one SQL entry?
Posted: Sun Sep 23, 2012 10:55 am
Another issue I'm having with MySQL;
Lets say I have 3 user profiles in a MySQL DB:
|username|ID|group_id|deleted|admin_of_group|
------------------------------------------------------------
|test1......| 1|........2|.......0|............person|
|bob........| 2|........1|.......0|..........abcedea|
|gary.......| 3|........2|.......1|............person|
------------------------------------------------------------
The following code:
My SQL query:
However if I order the results by username, then it would show the result previously hidden, and hide one of the results previously shown.
I have tried using a var_dump() in the while loop, and it only returned:
I simply don't know whats making it false :/
Lets say I have 3 user profiles in a MySQL DB:
|username|ID|group_id|deleted|admin_of_group|
------------------------------------------------------------
|test1......| 1|........2|.......0|............person|
|bob........| 2|........1|.......0|..........abcedea|
|gary.......| 3|........2|.......1|............person|
------------------------------------------------------------
The following code:
<?php while($user = mysql_fetch_array($usr_list)){ ?> <td><?php echo $user['username']; ?></td> <td><?php echo $user['id']; ?></td> <?php } ?>Will only show 2 of the 3 DB entries.
My SQL query:
$usr_list = mysql_query("SELECT * FROM acc WHERE `group_id` = '{$gid}' AND `deleted` = 0 AND `admin_of_group` = '{$session_NAME}'");I'm pretty sure that its not the query, because I tried it directly in phpMyAdmin with no issues.
However if I order the results by username, then it would show the result previously hidden, and hide one of the results previously shown.
I have tried using a var_dump() in the while loop, and it only returned:
And because a while loop only runs when the input is true...bool (false)
I simply don't know whats making it false :/