Question:
PHP error, Warning: mysql_fetch_assoc()?
anonymous
2008-07-05 17:49:21 UTC
OK I am getting this error but really cant see why, this is the code on the page:

$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 "

" . $row['subject'] . "


";
echo "In " . $row['cat'] . " - Posted on " . date("D jS F Y g.iA",strtotime($row['dateposted'])) . "";
echo "

";
echo nl2br($row['body']);
echo "

";

Can anyone please tell me where it's going wrong?
Three answers:
anonymous
2008-07-05 18:03:42 UTC
After your LIMIT clause you have an additional semicolon....try deleting that so the line is:



LIMIT 1";
slover
2016-10-22 09:42:56 UTC
Your question is in many situations failing. have you ever already fastened the relationship? If now no longer this is not even connecting to the database. in case you ave, use an blunders entice : $result = mysql_query($question) or die(mysql_error());
supercatbinx
2008-07-05 17:56:42 UTC
ok, well where did you get it?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...