I had this code working (I thought).
$sql = "SELECT
order.id,
order.date
FROM
order";
$result = mysql_query($sql) or die(mysql_error());
$rows = mysql_fetch_assoc($result);
foreach($rows as $row){
echo $row['id'].": ".$row['date']."<br>";
}
The result was the same as if I would use:
while($row = mysql_fetch_assoc($result)){
echo $row['id'].": ".$row['date']."<br>";
}
But strangely, today it stopped working. Or it never has, but then I'm getting a little crazy.
I want to use foreach() because the array $rows can also be 'manually' filled and not from a query.
What am I doing wrong..?