PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Well based on that error you know it is being caused on your SQL statement. Two great things I always do to figure out my SQL problems are:
1) Save SQL statements in a variable and echo them out to make sure they are correct
2) Use something like phpMyAdmin to make sure the SQL statement that you are using will work, you can just cut and copy it right into the SQL section and see what happens.
The addition of the link resource identifier (in this case $conn) is not required unless you are using more than one connection to the same server. In MySQL yhe backticks are always a good idea around database, table and column names in the event MySQL decides to add reserved words in the future.
Right now though I would imagine that your best help would come from a simple call to mysql_error() in the event the query fails.
<?php
$sql = 'SELECT * FROM `pets`';
if (!$result = mysql_query($sql)) {
die('Query had a problem: ' . mysql_error()); // You do not want mysql_error() in production!
}
// ... use the result here as you wish
?>