wilko88 Posted July 22, 2009 Share Posted July 22, 2009 Hey Guys, this is my code so far below, but I keep getting this error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/wscologn/public_html/phptesting/index.php on line 10 <?php require("header.php"); $sql = "SELECT entries.*, categories.cat FROM entries, categories WHERE entries.cat_id = categories.id ORDER BY dateposted DESC LIMIT 1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); echo "<h2><a href='viewentry.php?id=" . $row['id'] . "'>" . $row['subject'] . "</a></h2><br />"; echo "<i>In <a href='viewcat.php>id=" . $row['cat_id'] . "'>" . $row['cat'] . "</a> - Posted on " . date("D jS F Y g.iA", strtotime($row['dateposted'])) . "</i>"; echo "<p>"; echo nl2br($row['body']); echo "</p>"; require("footer.php"); ?> Any advice or help would be appreciated. Cheers, Dan Link to comment https://forums.phpfreaks.com/topic/166963-help-with-forum-code-please/ Share on other sites More sharing options...
Xyphon Posted July 22, 2009 Share Posted July 22, 2009 Try changing $sql = "SELECT entries.*, categories.cat FROM entries, categories WHERE entries.cat_id = categories.id ORDER BY dateposted DESC LIMIT 1;"; to $sql = "SELECT entries.*, categories.cat FROM entries, categories WHERE entries.cat_id = categories.id ORDER BY dateposted DESC LIMIT 1"; also put code tags around your scripts. Also, if you're having problems with queries you should do this mysql_query()or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/166963-help-with-forum-code-please/#findComment-880275 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.