09-09-2009, 04:13 PM
|
#2 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
Quote:
Originally Posted by Randy
Alright so I am looking to create a foreach statement using mysql query. I am not sure how I can do this seeing as how it requires an array_expression and value.
Here's my code:
PHP Code:
// Retrieve Data From The Database $query = 'SELECT * FROM entries ORDER BY DESC ID';
// Run The Above MySQL Query $results = 'mysql_query($query)';
How can i use the foreach statement to use the data over and over for each entry that has the ID tag.
Thanks,
Randy
|
A few things first:
1. ORDER BY DESC ID is not a valid statement, ORDER BY ID DESC would be
2. $results = 'mysql_query($query)'; should be $results = mysql_query($query); without the single quotes.
Then what you need to do is add this code:
PHP Code:
$arr_results = mysql_fetch_array($results);
Then you are ready to do the foreach loop.
|
|
|
|