MySQL Forums
Forum List  »  PHP

mysql_fetch_object(): supplied argument is not a valid MySQL result resource in public_html/games.php on line 16
Posted by: Phill Hargreaves
Date: January 22, 2007 10:04PM

I have this script that has been running fine up to when my host upgraded
there sql to version 4.1.21-standard and php version 4.4.4

I am now getting a few errors and nothing will work now.
Can I get some help please?

The errors I am getting are:
PHP Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /public_html/cats.php on line 5

Here are lines in the cats.php file:
4: $qr1 = mysql_query("SELECT * FROM cats WHERE id=$id");
5: $cat = mysql_fetch_object($qr1);

PHP Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /public_html/games.php on line 16

Here are lines in the cats.php file:
15: $qr1 = mysql_query("SELECT * FROM games WHERE cat=$id AND status=1 ORDER BY id DESC LIMIT 30");
16: while( $row = mysql_fetch_object($qr1) ){

the other file I am get errors in now shows this:
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /public_html/games.php on line 16

Here is the code that is having the problems:
<?

include("common.php");

if(@$_COOKIE["rating_$itemid"] != ""){
}else{
if($_POST['rateit']){
$sql = "UPDATE games SET vote=vote+1,sum=sum+".$_REQUEST['rateit']." WHERE id='".$_REQUEST['itemid']."'";
mysql_query($sql) or die( mysql_error() );
$itemid = $_REQUEST['itemid'];
setcookie("rating_$itemid", "1", time() + 3600 * 24 * 30);
}
}
Line 14: mysql_query("UPDATE games SET played=played+1 WHERE id=$id");
Line 15: $qamesid=mysql_query("SELECT * FROM games WHERE id=$id");
Line 16: $game=mysql_fetch_object($qamesid);
Line 17: $seo_title = $sitename." - Play ".stripslashes($game->name);

include("header.php");

if( strstr($game->flash,".dcr") ){
?>

I am a newbie to mysql so I have no idea how to fix this, I have alot of people
that play on my game site, so I need a fix soon please?

Thanks Regards, Phill

Options: ReplyQuote


Subject
Written By
Posted
mysql_fetch_object(): supplied argument is not a valid MySQL result resource in public_html/games.php on line 16
January 22, 2007 10:04PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.