need help with a few errors

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

need help with a few errors

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post 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;"));
Last edited by Smackie on Mon Feb 28, 2005 6:57 pm, edited 1 time in total.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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
Last edited by shiznatix on Mon Feb 28, 2005 6:59 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post by Smackie »

So how would i find out where the error is at on there?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

  1. output the SQL query, check it in phpMyAdmin or similar...
  2. find the divisors that are zero.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I assume error checking isn't disabled in const.php so it is actually connecting ok?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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?
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post 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...
Smackie
Forum Contributor
Posts: 302
Joined: Sat Jan 29, 2005 2:33 pm

Post 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/
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
Post Reply