ThaWorm Posted January 14, 2009 Report Share Posted January 14, 2009 I am working out of a book and I'm trying to run this code. $result = mysql_query($sql); $row = mysql_fetch_assoc($result); echo " . "'>" . $row['subject'] . " ?"; echo "In ."'>" . $row['cat'] . " - posted on " . date("D js F Y " , strtotime($row['dateposted'])) . ""; echo " "; echo nl2br($row['body']); echo ""; When I do I get this error Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource Can anyone help me out here. Also thanks in advance. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted January 15, 2009 Report Share Posted January 15, 2009 what is the line above your code sample, where you set the $sql variable? Should be something along the lines of $sql = ...sql query here... An incorrectly coded query could cause the problem. Quote Link to comment Share on other sites More sharing options...
ThaWorm Posted January 15, 2009 Author Report Share Posted January 15, 2009 $sql = "SELECT entries.*, categories.cat FROM entriesm, categories WHERE entries.cat_id = categories.id ORDER BY dateposted DESC LIMIT 1;"; Quote Link to comment Share on other sites More sharing options...
ThaWorm Posted January 15, 2009 Author Report Share Posted January 15, 2009 I just got it thank you for the help I must have over looked this too many time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.