mySQL / PHP array problems...

admin

Administrator
Staff member
I'm a relative newbie to all this, and I'm having a problem that all you PHP Guru's can probably solve in your sleep.

I have a mySQL table full of news articles, and I want to display the latest 10 on my site. I can retrieve all the information like so:

$sql = "SELECT * FROM NewsArticles ";
$sql .= "ORDER BY Date DESC LIMIT 0, 10";
$result = mysql_query($sql,$db);
$var = mysql_fetch_array($result);

The problem is that $var is a multi-dimensional variable which contains 10 records, and each record contains multiple fields, ($title, $author, $date, $body etc.) and short of dumping the whole contents out I don't know whole to extract all the name-value pairs.

Is there a standard way of unpacking these multi-dimensional arrays?

Thanks.
 
Back
Top