Warning: mysql_fetch_assoc() expects parameter 1?
Posted: Mon Jul 19, 2010 7:59 pm
Hello,
When I write this:
I get this:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/photo.php on line 12.
Line 12 is:
Anyone have any ideas what I am doing wrong. Thanks!!
Thanks,
df
When I write this:
Code: Select all
<?php
require("incl/header.php");
require("incl/menu.php");
?>
<!------------------------------ HEADER ------------------------------------->
<?php
$sql = "Select photos.*, categories.cat FROM photos, categories
WHERE photos.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['title'] . "</a></h2><br>";
?>
<!------------------------------ FOOTER ------------------------------------->
<?php
require("incl/footer.php");
?>
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/photo.php on line 12.
Line 12 is:
Code: Select all
$row = mysql_fetch_assoc($result);Thanks,
df