Page 1 of 1

need help with a few errors

Posted: Mon Feb 28, 2005 6:41 pm
by Smackie
alright well im adding a few open source RPG games to my site and well im having problem with one im adding it keeps giving me errors and yes i know i should go to there website and ask for help... which i did like 2 weeks ago and still havent got any help one it so i came here to see if any of you could help me on it here is all i keep getting.....
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/haunted/public_html/promisance/funcs.php on line 41

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/haunted/public_html/promisance/funcs.php on line 41

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/haunted/public_html/promisance/funcs.php on line 41

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/haunted/public_html/promisance/funcs.php on line 79

Warning: Division by zero in /home/haunted/public_html/promisance/funcs.php on line 67

Warning: Division by zero in /home/haunted/public_html/promisance/funcs.php on line 67

Warning: Division by zero in /home/haunted/public_html/promisance/funcs.php on line 67

Warning: Division by zero in /home/haunted/public_html/promisance/funcs.php on line 67

Warning: Division by zero in /home/haunted/public_html/promisance/funcs.php on line 67
thank you
Smackie

Posted: Mon Feb 28, 2005 6:45 pm
by Chris Corbyn
Code please :lol: The problem is with how you are querying the database and all the rest stems from that by the look of it.

Posted: Mon Feb 28, 2005 6:49 pm
by Smackie
here are the error lines....

Code: Select all

line 41:::

   $data = mysql_fetch_row(mysql_query($query)); 
   return $dataї0]; 

line 67:::


   return floor(($userїarmtrp] * 1) + ($userїlndtrp] * $configїlndtrp] / $configїarmtrp]) + ($userїflytrp] * $configїflytrp] / $configїarmtrp]) + ($userїseatrp] * $configїseatrp] / $configїarmtrp]) + ($userїwizards] * 2) + ($userїpeasants] * 3) + (($userїcash] + $userїsavings]/2 - $userїloan]*2) / (5 * $configїarmtrp])) + ($userїland] * 500) + ($userїfreeland] * 100) + ($userїfood] * $configїfood] / $configїarmtrp])); 


line 79:::

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

Posted: Mon Feb 28, 2005 6:53 pm
by shiznatix
nobody is ever going to read that whole thing, try posting just the lines that give you errors.

Edit: thanks for the edit to ur post

Posted: Mon Feb 28, 2005 6:57 pm
by feyd
  1. your sql syntax has errors.
  2. which likely causes your division warnings.. Although you may get these warnings regardless if the divisor is zero..
  3. quote your nonnumeric array indices

Posted: Mon Feb 28, 2005 6:59 pm
by Smackie
So how would i find out where the error is at on there?

Posted: Mon Feb 28, 2005 7:02 pm
by feyd
  1. output the SQL query, check it in phpMyAdmin or similar...
  2. find the divisors that are zero.

Posted: Mon Feb 28, 2005 7:04 pm
by Chris Corbyn
I've got the full file you initially posted here...

When did it last work... what have you editted recently so we can narrow it down a bit. Most of your queries handled by functions so I'm just looking over where you called them all. As feyd said too, put quotes around your non-numeric data so that you don't get division by zero.

You must have been testing as you were writing it.... you didn't just write all that and then run it and get these few errors did you? Just look over the recently modified stuff (queries in particular) and narrow it down.

Posted: Mon Feb 28, 2005 7:11 pm
by Smackie
well i only edited the const.php which is connecting to the database and thats it.. and well i been trying to set this game up for like maybe a month and a half... but i cant get it to set up right for some reason :-S... but if someone would like to come and help set it up i would really appreciate it...

right now im kinda tired out of my mind lol im always working 18 hours a day on my site and working with other peoples problems they have on html crap so right now i dont know what you mean by

output the SQL query, check it in phpMyAdmin or similar...
find the divisors that are zero.

Posted: Mon Feb 28, 2005 7:13 pm
by Chris Corbyn
I assume error checking isn't disabled in const.php so it is actually connecting ok?

Posted: Mon Feb 28, 2005 7:16 pm
by Chris Corbyn
I can't see where you're including const.php or connecting to the database in this funcs.php file. Do you have it in an include? I tried CTRL+F and searched the whole file for "const.php" and "mysql_connect" but got nothing. You have a html.php include at the top.. What's in there?

Posted: Mon Feb 28, 2005 7:17 pm
by Smackie
it connects just fine.. and it came with a install text and i did what it said to do and still it keeps screwing up for some reason...

Posted: Mon Feb 28, 2005 7:21 pm
by Smackie
see im not the one who build the game.. im just a person that is putting it on my site... its an open source RPG game... and if you want to download it and see if you can figure it out go to
http://sourceforge.net/projects/promisance/

Posted: Mon Feb 28, 2005 7:27 pm
by Chris Corbyn
Hmmm... well there's like 860 lines of code in this funcs.php file and loads of queries jumbled into it all over the place so I can't really see what's going on unfortunately.

Source is here for the next 5 days color coded for easy viewing if anybody wishes to try and help.

I really need some sleep :-( Gotta be up for work in 4 hrs.