Day Walker Posted January 6, 2007 Share Posted January 6, 2007 is there someone who will look over a page and see if you can see any errors...i cant find the problem... :-\ i am trying to teach my self and am a for sure rookie,lol...help please Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/ Share on other sites More sharing options...
genericnumber1 Posted January 6, 2007 Share Posted January 6, 2007 Do you errors enabled?And yes, you can post code here... Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154360 Share on other sites More sharing options...
ryld Posted January 6, 2007 Share Posted January 6, 2007 Unless the file is bogged with errors, you shouldn't need to post the entire page. The error message will tell you which file and line the error is generated by. Then just post that line (and maybe relevant code such as if it's part of an if statement). This is, of course, assuming you are using a method to echo errors... Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154383 Share on other sites More sharing options...
Day Walker Posted January 6, 2007 Author Share Posted January 6, 2007 well...the line it is telling me there is an error on is correct...it is after i added the other section that i now get the error...it says it is calling to an undefined object...the piece i added is kinda long and i think i made a mistake or two...as i said i am a n00b just trying to learn...i'll post the section here if i may... Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154399 Share on other sites More sharing options...
genericnumber1 Posted January 6, 2007 Share Posted January 6, 2007 you.. may? Don't worry about asking if you can, just do it. :P but try to localize the problem a little so we don't get hit with a billion lines... if you REALLY can't (it happens) I guess we can TRY to sift through it. Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154400 Share on other sites More sharing options...
ryld Posted January 6, 2007 Share Posted January 6, 2007 Generic-You don't like reading through a billion lines of code?Not to hijack! But please do post your code...and try to localize it as Genericnumber1 said...because we're lazy and don't want to read more than 3 or 4 lines. :PWell, I am anyway. Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154405 Share on other sites More sharing options...
Day Walker Posted January 6, 2007 Author Share Posted January 6, 2007 well then ...thanks for the willingness to help any way...im not sure just exactually where i messed up..i think it is in a section of 232 lines...total page is 3018...no way i would post that much,lol...thanks anyway Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154417 Share on other sites More sharing options...
ryld Posted January 6, 2007 Share Posted January 6, 2007 :oOkay. Well, try this. Make a backup copy of the file and start doing some test. Work your way from the bottom removing relevant blocks of code at a time and running the script with each edit. Or, alternatively, remove all of the code after the point which you KNOW works, then slowly add one segment at a time, running the script again each time you add a new segment until you receive an error again. Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154425 Share on other sites More sharing options...
genericnumber1 Posted January 6, 2007 Share Posted January 6, 2007 Stick that 232 section in code tags... and I'll just let my IDE debug it then ? no promises though, big chunks of code make me gag.I'm surprised that you couldn't localize the problem to a smaller area than that? Tell us what the error is and we may not even have to see code, unless it's something like "unexpected BLAH" Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154426 Share on other sites More sharing options...
Day Walker Posted January 6, 2007 Author Share Posted January 6, 2007 the error i get is :Fatal error: Call to a member function on a non-object in /home/bloodshe/public_html/BLOODSHEDDdev/global_funcs.php on line 374 however this error never happened till after i added this: starting @ line(513)new block quoted.../* $torps = 90; $fighters = 100; $armor = 150; $energy = 200; $spy = 300; $wormhole = 350; $sg = 500; $nova = 550; $torps_trigger = floor($torps / 2); $fighters_trigger = floor($fighters / 2); $armor_trigger = floor($armor / 2); $energy_trigger = floor($energy / 2); $spy_trigger = floor($spy / 2); $wormhole_trigger = floor($wormhole / 2); $sg_trigger = floor($sg_torp / 2); $nova_trigger = floor($nova / 2); $flag = 1; $amount = round($credits * (mt_rand(($deathlostpercent / 2), $deathlostpercent) / 100)); $debug_query = $db->Execute("UPDATE $dbtables[players] SET credits=credits-$amount WHERE player_id=$player_id"); db_op_result($debug_query,__LINE__,__FILE__); $debris_type = 14; $debris_data = $amount; $findem = $db->Execute("SELECT sector_id FROM $dbtables[universe]"); $totrecs=$findem->RecordCount(); $getit=$findem->GetArray(); $randplay=mt_rand(0,($totrecs-1)); $targetlink = $getit[$randplay]['sector_id']; $debug_query = $db->Execute("INSERT INTO $dbtables[debris] (debris_type, debris_data, sector_id) values ($debris_type,'$debris_data', $targetlink)"); db_op_result($debug_query,__LINE__,__FILE__); $success = mt_rand(0, $torps); if ($success == $torps_trigger && $flag) { $debris_type = 2; $debris_data = 1; if(mt_rand(0, 1) == 1) $debris_data = -1 * $debris_data; $flag = 0; } $success = mt_rand(0, $fighters); if ($success == $fighters_trigger && $flag) { $debris_type = 3; $debris_data = 1; if(mt_rand(0, 1) == 1) $debris_data = -1 * $debris_data; $flag = 0; } $success = mt_rand(0, $armor); if ($success == $armor_trigger && $flag) { $debris_type = 4; $debris_data = 1; if(mt_rand(0, 1) == 1) $debris_data = -1 * $debris_data; $flag = 0; } $success = mt_rand(0, $energy); if ($success == $energy_trigger && $flag) { $debris_type = 5; $debris_data = 1; if(mt_rand(0, 1) == 1) $debris_data = -1 * $debris_data; $flag = 0; } $success = mt_rand(0, $spy); if ($success == $spy_trigger && $flag) { $debris_type = 7; $debris_data = 1; if(mt_rand(0, 1) == 1) $debris_data = -1 * $debris_data; $flag = 0; } $success = mt_rand(0, $wormhole); if ($success == $wormhole_trigger && $flag) { $debris_type = 8; $debris_data = 1; $flag = 0; } $success = mt_rand(0, $sg); if ($success == $sg_trigger && $flag) { $debris_type = 11; $debris_data = 1; if(mt_rand(0, 1) == 1) $debris_data = -1 * $debris_data; $flag = 0; } $success = mt_rand(0, $nova); if ($success == $nova_trigger && $flag) { $debris_type = 12; $debris_data = 1; if(mt_rand(0, 1) == 1) $debris_data = -1 * $debris_data; $flag = 0; } if ($flag) { $debris_type = 0; $debris_data = 0; } $randplay=mt_rand(0,($totrecs-1)); $targetlink = $getit[$randplay]['sector_id']; $debug_query = $db->Execute("INSERT INTO $dbtables[debris] (debris_type, debris_data, sector_id) values ($debris_type,'$debris_data', $targetlink)"); db_op_result($debug_query,__LINE__,__FILE__);}} //To here was original...i added following and will set values later...but now i get the error...what did i do wrong? $torps = 90; $fighters = 100; $armor = 150; $energy = 200; $spy = 300; $wormhole = 350; $sg = 500; $nova = 550; $torps_trigger = floor($torps / 2); $fighters_trigger = floor($fighters / 2); $armor_trigger = floor($armor / 2); $energy_trigger = floor($energy / 2); $spy_trigger = floor($spy / 2); $wormhole_trigger = floor($wormhole / 2); $sg_trigger = floor($sg_torp / 2); $nova_trigger = floor($nova / 2); $flag = 1; $amount = round($credits * (mt_rand(($deathlostpercent / 2), $deathlostpercent) / 100)); $debug_query = $db->Execute("UPDATE $dbtables[players] SET credits=credits-$amount WHERE player_id=$player_id"); db_op_result($debug_query,__LINE__,__FILE__); $asteroids_type = 14; $asteroids_data = $amount; $findem = $db->Execute("SELECT sector_id FROM $dbtables[universe]"); $totrecs=$findem->RecordCount(); $getit=$findem->GetArray(); $randplay=mt_rand(0,($totrecs-1)); $targetlink = $getit[$randplay]['sector_id']; $debug_query = $db->Execute("INSERT INTO $dbtables[asteroids] (asteroids_type, asteroids_data, sector_id) values ($asteroids_type,'$asteroids_data', $targetlink)"); db_op_result($debug_query,__LINE__,__FILE__); $success = mt_rand(0, $torps); if ($success == $torps_trigger && $flag) { $asteroids_type = 2; $asteroids_data = 1; if(mt_rand(0, 1) == 1) $asteroids_data = -1 * $asteroids_data; $flag = 0; } $success = mt_rand(0, $fighters); if ($success == $fighters_trigger && $flag) { $asteroids_type = 3; $asteroids_data = 1; if(mt_rand(0, 1) == 1) $asteroids_data = -1 * $asteroids_data; $flag = 0; } $success = mt_rand(0, $armor); if ($success == $armor_trigger && $flag) { $asteroids_type = 4; $asteroids_data = 1; if(mt_rand(0, 1) == 1) $asteroids_data = -1 * $asteroids_data; $flag = 0; } $success = mt_rand(0, $energy); if ($success == $energy_trigger && $flag) { $asteroids_type = 5; $asteroids_data = 1; if(mt_rand(0, 1) == 1) $asteroids_data = -1 * $asteroids_data; $flag = 0; } $success = mt_rand(0, $spy); if ($success == $spy_trigger && $flag) { $asteroids_type = 7; $asteroids_data = 1; if(mt_rand(0, 1) == 1) $asteroids_data = -1 * $asteroids_data; $flag = 0; } $success = mt_rand(0, $wormhole); if ($success == $wormhole_trigger && $flag) { $asteroids_type = 8; $asteroids_data = 1; $flag = 0; } $success = mt_rand(0, $sg); if ($success == $sg_trigger && $flag) { $asteroids_type = 11; $asteroids_data = 1; if(mt_rand(0, 1) == 1) $asteroids_data = -1 * $asteroids_data; $flag = 0; } $success = mt_rand(0, $nova); if ($success == $nova_trigger && $flag) { $asteroids_type = 12; $asteroids_data = 1; if(mt_rand(0, 1) == 1) $asteroids_data = -1 * $asteroids_data; $flag = 0; } if ($flag) { $asteroids_type = 0; $asteroids_data = 0; } $randplay=mt_rand(0,($totrecs-1)); $targetlink = $getit[$randplay]['sector_id']; $debug_query = $db->Execute("INSERT INTO $dbtables[asteroids] (asteroids_type, asteroids_data, sector_id) values ($asteroids_type,'$asteroids_data', $targetlink)"); db_op_result($debug_query,__LINE__,__FILE__);}}*/ Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154431 Share on other sites More sharing options...
genericnumber1 Posted January 6, 2007 Share Posted January 6, 2007 can you give us this line with the error? maybe 5 lines above and below it as well just in case? Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154433 Share on other sites More sharing options...
Day Walker Posted January 6, 2007 Author Share Posted January 6, 2007 lines 366 thru 380/* while (!$res2->EOF) { $row2 = $res2->fields; $score += $row2['score2']; $res2->MoveNext(); } // End Ship Score loop $debug_query = $db->Execute("SELECT credits FROM $dbtables[players] where player_id = $sid"); db_op_result($debug_query,__LINE__,__FILE__); if ($debug_query) { $row = $debug_query->fields; $score += $row['credits']; }*/ Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154434 Share on other sites More sharing options...
Day Walker Posted January 6, 2007 Author Share Posted January 6, 2007 line 374==>// End Ship Score loopFatal error: Call to a member function on a non-object in /home/bloodshe/public_html/BLOODSHEDDdev/global_funcs.php on line 374sorry forgot this Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154438 Share on other sites More sharing options...
Jessica Posted January 6, 2007 Share Posted January 6, 2007 So what it's saying it's there's a problem with your $db->Execute. Are you use ADODB? Have you checked that your mysql connection is valid? Where is the code where you create $db Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154445 Share on other sites More sharing options...
genericnumber1 Posted January 6, 2007 Share Posted January 6, 2007 normally what causes this is a variable not being declared...$db->Execute() would cause this same error if $db wasn't declared.check to make sure you aren't inside a function/method trying to use a variable not in it's scope... let me give you an example...[code=php:0]$db = new db();function doStuff() { $db->Execute('SELECT * FROM table'); // this will flag the same error you have}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154446 Share on other sites More sharing options...
Day Walker Posted January 6, 2007 Author Share Posted January 6, 2007 ok...everything ran great till i added from here down (} //To here was original...i added following and will set values later...but now i get the error...what did i do wrong?) in the big chunck i posted...i dont think i added it correctly...db is correct...blah... Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154449 Share on other sites More sharing options...
Day Walker Posted January 7, 2007 Author Share Posted January 7, 2007 oh well...thanks for trying...happy new year everyone Quote Link to comment https://forums.phpfreaks.com/topic/33135-need-help/#findComment-154585 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.