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

Lists in Python -

android - can not access to progress bar in an other activity -

html - Not able to access next element of an array javascript -