
April 15th, 2004, 08:53 PM
|
|
Registered User
|
|
Join Date: Apr 2007
Posts: 22,309
Time spent in forums: < 1 sec
Reputation Power: 24
|
|
|
mysql_fetch_assoc(): problem in the news/comments tutorial
ok then. im trying to learn some php. i took matt wades code from the tutorial and i messed with it a whole bunch, only to see this:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource... on line 29
i thought that it was my tinkering that did it, so i went and copied the thing right from the tutorial, pasted it, uploaded it, and the same thing occured.
php Code:
Original
- php Code |
|
|
|
if ($all == 0) { /* this query is for up to $max_items */ $query = "SELECT id,title,newstext," . "DATE_FORMAT(postdate, '%Y-%m-%d') as date " . "FROM news ORDER BY postdate DESC LIMIT $max_items"; } else { /* this query will get all news */ $query = "SELECT id,title,newstext," . "DATE_FORMAT(postdate, '%Y-%m-%d') as date " . "FROM news ORDER BY postdate DESC"; } /* line 29 ^ this is causing the error*/ echo "<TABLE border="1 " width="300 ">n"; /* place table row data in * easier to use variables. * Here we also make sure no * HTML tags, other than the * ones we want are displayed */ $date = $row['date'];
im seriously confused. im a newb. ive been sitting in front of this for a while, and ive tried different things. someone please throw me a bone. thanks a lot. maybe one day i can help people as lost as i am.
PHP v4.3.3
OS Linux
|