I think here's your problem:

  $query="INSERT INTO game_of_the_day VALUES
('',$curr_yday,'$gameone_genre',$gameone_number,'$gametwo_genre',$gametwo_nu
mber)";

should look like : 

  $query="
INSERT INTO
        game_of_the_day
(ID, curr_yday, gameone_genre, gameone_number, gametwo_genre,
gametwo_number)
        VALUES
('',$curr_yday,'$gameone_genre',$gameone_number,'$gametwo_genre',$gametwo_nu
mber)
";

try it.


Sincerely, 

 Maxim Maletsky
 Founder, Chief Developer
 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com



-----Original Message-----
From: Brian Rue [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 12:24 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] MySQL problem...


Here's all the code that uses MySQL...

 $db = mysql_connect("localhost","user","pass");
  mysql_select_db("db",$db);
  $gmdquery="SELECT * FROM game_of_the_day";
  $the_info = mysql_query($gmdquery,$db);

while ($myrow = mysql_fetch_row($the_info)) {
        (get info from the result)
}

... (decide whether or not to conduct the following operation)

if (true) {
   $query="SELECT id FROM games WHERE rating >= 7";
   $result=mysql_query($query,$db);
   $numgames=mysql_num_rows($result);
   $z=0;
   while ($row=mysql_fetch_row($result)){
    $gotd_cand[$z]=$row[0];
    $z++;
   }

   (at this point, i randomly select 2 games from the db)

     $query="SELECT genre,number FROM games WHERE id=$game1_to_get";
     $gameinfo=mysql_query($query,$db);
     while($row=mysql_fetch_row($gameinfo)){
      (use the result)
     }

(do the same thing as before, but for the second game)


   }
      (update the db)
   $query="DELETE FROM game_of_the_day";
   $result=mysql_query($query,$db);


   $query="INSERT INTO game_of_the_day VALUES
('',$curr_yday,'$gameone_genre',$gameone_number,'$gametwo_genre',$gametwo_nu
mber)";
   $result=mysql_query($query,$db);

  }



Keep in mind that this only happens some of the time... sometimes it works,
and sometimes it just doesn't.


Today, I noticed that it stored the first game into the db twice (the code
doesn't allow for the same game to be selected twice...)



Thanks for your time


""Peter Houchin"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> some code would be nice to have a look at :)
>
> Other than that, check table names, database names, also your result
lines, I've found i get that error by not calling a result or calling the
incorrect table/database
>
> Peter
>
> -----Original Message-----
> From: Brian Rue [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 26, 2001 10:28 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] MySQL problem...
>
>
> MySQL doesn't like me....
>
> Sometimes, my pages that connect to the database get the error "Warning:
> Supplied argument is not a valid MySQL result resource..." repeated over
and
> over again (something like 1000 times...)
>
> What's causing this error? Obviously, PHP isn't getting a result back from
> MySQL... and it keeps trying to get it.
>
> Any help?
>
>
> Thanks,
> Brian Rue
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to