By tonyp001 on
I'm trying to run a simple query that returns all the results in a table.
$query = db_query("SELECT name FROM {my_table}");
$result = db_fetch_array($query);
echo db_num_rows($query);
print_r($result);
When I run it and count the rows with db_num_rows, I get the correct number of rows; however, when I use db_fetch_array (or db_fetch_object for that matter), it only returns the first row. Does anyone have any idea what's happening here? Am I missing something?
I'd appreciate any help, because this is driving me nuts. Thanks!
Comments
Those functions fetch on row
Those functions fetch on row at a time so they are used something like
That makes sense...
I figured that the print_r() would reveal all the arrays. I guess not.
Thanks for the help!