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!
$qry = mysql_query ("SELECT * FROM users ORDER BY id LIMIT 1,20");
$row = array(mysql_fetch_assoc($qry));
for ($i = 0; $i < $rows; $i++){
echo "<TR><TD ALIGN=CENTER VALIGN=TOP WIDTH="5%">";
echo $rowї$i]ї'id'];
echo "</TD>";
echo "<TD ALIGN=LEFT VALIGN=TOP>";
echo $rowї$i]ї'login'];
echo "</TD>";
echo "<TD ALIGN=CENTER VALIGN=TOP>";
echo $rowї$i]ї'date'];
echo "</TD></TR>";
}
as you can see i want to order all the users in users table by their id... so i want 2 arrays....
one for each row... then inside that i want an associative array..
with mysql_fetch_assoc you fetch a single result row as an associative array, so you can access the fields by their db-field-name.
However, the important thing is: you only fetch a single line. So you have to do it as long as there are result-rows remaining. You may do this by a for-loop with mysql_num_rows or even simpler with a while-loop having the result of mysql_fetch_assoc as condition