Menu
Hi!
I’m currently retrieving and displaying results from my sql table using the following:
[code=php]
<?
$sql = “SELECT * FROM news”;
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res)) {
echo ‘<div class=”news-title”>’ . $row[1] . ‘</div>’;
echo ‘<div class=”news-date”>’ . $row[2] . ‘</div>’;
}
?>
However, I’m keen to store all the data outputted from this query in a single variable.
Would I have to use arrays, or is there an easy way of doing this?
Many thanks.