View Single Post
Old 09-10-2009, 12:29 AM   #4 (permalink)
adamdecaf
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

PHP Code:
// Credit should be given to wordpress, I've been studying 
// their code and came across this, it really is nice.
$query mysql_query('SELECT * FROM entries ORDER BY ID DESC');

foreach (
$query as $data) {
    
$results mysql_fetch_assoc($data);
}

// Now you should have an associative array 
// with all of the rows returned from the query.
// So, we can just print them out to show you.
print_r($results); 

The reason that "mysql_fetch_array()" was not working is because it accepts two arguments (2nd is optional but recommended):
$result - The MySQL query...
$type - How you want the data back, numeric or assoc. $data[0] vs $data['name']

E.G. mysql_fetch_array($query, MYSQL_ASSOC);
__________________
My Site
adamdecaf is offline  
Reply With Quote
The Following User Says Thank You to adamdecaf For This Useful Post:
Randy (09-10-2009)