I added a WHERE clause to the code to see if that helped, but no dice.
<?
mysql_connect("localhost", "root", "7982ncxz");
mysql_select_db("support");
$query = mysql_query("SELECT * FROM ticket_attachments WHERE ref='12'");
$result = mysql_query($query) or die (mysql_error());
$num_results = mysql_num_rows($result);
echo $num_results;
?>
That produced the same error.
Here's a screen shot to show that those records do exist. 😉