Jump to content


Photo

mysql_fetch_row(): error help


  • Please log in to reply
4 replies to this topic

#1 cohan1279

cohan1279
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 19 July 2006 - 12:09 AM

hi ive been trying to find help every where for this without any luck. i have been trying to get a program/game called promisance working but i get the following error

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/www/cbc1219.awardspace.com/funcs.php on line 41

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/www/cbc1219.awardspace.com/funcs.php on line 41

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/www/cbc1219.awardspace.com/funcs.php on line 41

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/cbc1219.awardspace.com/funcs.php on line 82
FATAL ERROR: Failed to update player data

Ive tryed getting help from the author but there hasnt been any supoort for a few years now. Ive also posted in mysql forum but was told it a php problem. so here i am

here is the funcs.php error lines.


line 37-43 
// evaluate an SQL query, return first cell of first row
// useful for "SELECT count(*) ..." queries
function sqleval ($query)
{
$data = mysql_fetch_row(mysql_query($query));
return $data[0];
}

and line 75-87
// loads the information for the specified user number
function loadUser ($num)
{
global $playerdb;
return mysql_fetch_array(mysql_query("SELECT * FROM $playerdb WHERE num=$num;"));
}

// loads the information for the specified race number
function loadRace ($race)
{
global $racedb;
return mysql_fetch_array(mysql_query("SELECT * FROM $racedb WHERE id=$race;"));
}


any ideas?


#2 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 19 July 2006 - 12:26 AM

return mysql_fetch_array(mysql_query("SELECT * FROM $playerdb WHERE num=$num;"));
return mysql_fetch_array(mysql_query("SELECT * FROM $racedb WHERE id=$race;"));

see the WHERE id=$race, the actual value need to enclose in single quote, so change them to:

return mysql_fetch_array(mysql_query("SELECT * FROM $playerdb WHERE num='$num';"));
return mysql_fetch_array(mysql_query("SELECT * FROM $racedb WHERE id='$race'"));

Life's too short for arguing.

#3 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 19 July 2006 - 12:28 AM

Either your mysql_connect is failing, or your database is failing to connect. 

Seperate the query line into two statements, and add a mysql_error to the query:

$result = mysql_query($query) or die(mysql_error());
$data = mysql_fetch_row($result);


#4 cohan1279

cohan1279
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 19 July 2006 - 01:01 AM

ok this is now what i have

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/www/cbc1219.awardspace.com/funcs.php on line 41
Table 'cohan1219_cohan.players' doesn't exist

ok any help on how to create a table for it? sorry im a complete noob!!
thing is I thuoght that was the problem as in the install it said i needed to to create a table                "4. Create the MySQL tables:
                      $ mysql -uusername -p[password] databasename <prom.sql"
but know one would tell me what this means? just kept telling me i had a php problem.so anymore help?

#5 cohan1279

cohan1279
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 19 July 2006 - 01:30 AM

http://www.phpfreaks...c,101030.0.html

this is to a post with the script if if helps. any more help would be greatly appreciated.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users