Jump to content

Archived

This topic is now archived and is closed to further replies.

cohan1279

mysql_fetch_row(): error help

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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'"));

Share this post


Link to post
Share on other sites
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:

[code]$result = mysql_query($query) or die(mysql_error());
$data = mysql_fetch_row($result);[/code]

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
http://www.phpfreaks.com/forums/index.php/topic,101030.0.html

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.