Try removing the @ from your connection and database selection calls, and change the line
$result_count = mysql_query($query_count);
to read
$result_count = mysql_query($query_count) or die(mysql_error());
If you read the error messages you'll see that it ran into trouble just trying to count the rows of your first query (which, incidentally, will always be 1 once you get it working). So one can guess that it was failing before then, and you just didn't know because you were suppressing error messages.