Page 1 of 1

[SOLVED] Retrieving most recent data

Posted: Mon Apr 12, 2004 6:37 pm
by Steveo31
Heyo.. have a lil problem with my script:

Code: Select all

<?php
$sql = " SELECT body, title FROM articles WHERE DAYOFMONTH( NOW( ) - INTERVAL 10 DAY )";
$query = mysql_query($sql);
while($row = mysql_query($query)){
echo $row['title'];
echo $row['body'];
}
?>
This code works in PhpMyAdmin, but not in PHP. No errors, no nothin, not even the data.

I'm not sure where the error is, but am I missing something?

Posted: Mon Apr 12, 2004 7:03 pm
by Steveo31
Wow, I'm not very smart. I used while($row=mysql_query) instead of while($row=mysql_fetch_assoc).

I'm going to leave it here for those who are interested.