09-10-2009, 09:23 AM
|
#6 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
The problem is that you can't loop over a mysql resource, you must have the array assignment before the loop otherwise there is nothing to loop over.
Whats wrong with the good ol' while loop, eh?
PHP Code:
while($row=mysql_fetch_assoc($query)) { print_r($row); //echo $row['description']; }
If you really must use a for loop, this should work:
PHP Code:
$query = mysql_query('SELECT * FROM entries ORDER BY ID DESC'); $rows = mysql_num_rows($query);
for($i = 0; $i < $rows; ++$i) { mysql_data_seek($query, $i); $data = mysql_fetch_assoc($query); echo $data['description'] . '<br />'; }
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
Last edited by sketchMedia : 09-10-2009 at 09:50 AM.
|
|
|
|