php - SQL SELECT * returns only one row -


i'm designing website , wrote webpage display list of users. used a

$query = select * `table_users` `id`='.$id.' 

and increment id "while" can grab users. it's slow now, , glitches when there gap between ids.

so tried

$query = select `name` `tbl_user`order `id` 

and displaying userlist a

while ($i < sizeof(mysql_fetch_array(mysql_query($query)))){ <code display user> $i++ } 

but mysql_fetch_array returnes 1 user, first 1 (the 1 littliest id). want return users in array. how do ?

try this

$query = "select `name` `tbl_user` order `id`"; $user_query = mysql_query($query);  $i=1; while ($row = mysql_fetch_array($user_query)){   echo $i." : ".$row['name']."<br>";   $i++; } 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -