grant Posted December 16, 2010 Share Posted December 16, 2010 tryed so many ways to fix this ??? need some help pointing me to fix it thanks $result = mysql_query ("SELECT * FROM `updates` WHERE `name` = 'trevor'"); while ($line = mysql_fetch_array($updates_sql, MYSQL_ASSOC)) { $update = $line['lastdone']; } $timesinceupdate = time() - $update; if ($timesinceupdate>=300) { $num_updates = floor($timesinceupdate / 300); //stock market stuff $result = mysql_query("SELECT * FROM `stocks`"); while($line = mysql_fetch_assoc($result)) { $amount = rand (strlen($line['cost']) * -1, strlen($line['cost'])); $newamount = $line['cost'] + $amount; if ($newamount < 1){ $newamount = 1; } $result2 = mysql_query("UPDATE `stocks` SET `cost`='".$newamount."' WHERE `id`='".$line['id']."'"); } //stock market stuff $result = mysql_query("SELECT * FROM `grpgusers`"); while($line = mysql_fetch_assoc($result)) { $updates_user = new User($line['id']); if ($updates_user->rmdays > 0) { $multiplier = 2; } else { $multiplier = 1; } $username = $updates_user->username; $newawake = $updates_user->awake + (5 * $num_updates) * $multiplier; $newawake = ($newawake > $updates_user->maxawake) ? $updates_user->maxawake : $newawake; $newhp = $updates_user->hp + (10 * $num_updates) * $multiplier; $newhp = ($newhp > $updates_user->maxhp) ? $updates_user->maxhp : $newhp; $newenergy = $updates_user->energy + (2 * $num_updates) * $multiplier; $newenergy = ($newenergy > $updates_user->maxenergy) ? $updates_user->maxenergy : $newenergy; $newnerve = $updates_user->nerve + (2 * $num_updates) * $multiplier; $newnerve = ($newnerve > $updates_user->maxnerve) ? $updates_user->maxnerve : $newnerve; $result2 = mysql_query("UPDATE `grpgusers` SET `awake` = '".$newawake."', `energy` = '".$newenergy."', `nerve` = '".$newnerve."', `hp` = '".$newhp."' WHERE `username` = '".$username."'"); } //update the timer and db $thetime = time(); $result2 = mysql_query("UPDATE `updates` SET `lastdone` = '".$thetime."' WHERE `name` = 'trevor'"); $leftovertime = $timesinceupdate - (floor($timesinceupdate / 300) * 300); if ($leftovertime>0) { $newupdate = time() - $leftovertime; $setleftovertime = mysql_query("UPDATE `updates` SET `lastdone` = '".$newupdate."' WHERE `name` = 'trevor'"); } } $updates_sql = mysql_query("SELECT * FROM `updates` WHERE `name` = 'hospital'"); while ($line = mysql_fetch_array($updates_sql, MYSQL_ASSOC)) { $update = $line['lastdone']; } $timesinceupdate = time() - $update; if ($timesinceupdate>=60) { $num_updates = floor($timesinceupdate / 60); $result = mysql_query("SELECT * FROM `grpgusers`"); //DO STUFF while($line = mysql_fetch_assoc($result)) { $result_user = mysql_query("SELECT * FROM `grpgusers` WHERE `id`='".$line['id']."'"); $updates_user = mysql_fetch_array($result_user); $newhospital = $updates_user['hospital'] - (60 * $num_updates); $newhospital = ($newhospital < 0) ? 0 : $newhospital; $newjail = $updates_user['jail'] - (60 * $num_updates); $newjail = ($newjail < 0) ? 0 : $newjail; $result2 = mysql_query("UPDATE `grpgusers` SET `hospital` = '".$newhospital."', `jail` = '".$newjail."' WHERE `id` = '".$line['id']."'"); } $result = mysql_query("SELECT * FROM `effects`"); while($line = mysql_fetch_assoc($result)) { if($line['timeleft'] > 0){ $newamount = $line['timeleft'] - (1 * $num_updates); $result2 = mysql_query("UPDATE `effects` SET `timeleft` = '".$newamount."' WHERE `id` = '".$line['id']."'"); } } $result2 = mysql_query("DELETE FROM `effects` WHERE `timeleft` < 1"); //update the timer and db $thetime = time(); $result2 = mysql_query("UPDATE `updates` SET `lastdone` = '".$thetime."' WHERE `name` = 'hospital'"); $leftovertime = $timesinceupdate - (floor($timesinceupdate / 60) * 60); if ($leftovertime>0) { $newupdate = time() - $leftovertime; $setleftovertime = mysql_query("UPDATE `updates` SET `lastdone` = '".$newupdate."' WHERE `name` = 'hospital'"); } } Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted December 16, 2010 Share Posted December 16, 2010 Include the connection file? Quote Link to comment Share on other sites More sharing options...
grant Posted December 16, 2010 Author Share Posted December 16, 2010 Include the connection file?well i have tryed the dbcon still the not working here if the code if u have any ideas of wot mite be wrong <? //Updates $result = mysql_query ("SELECT * FROM `updates` WHERE `name` = 'trevor'"); while ($line = mysql_fetch_array($updates_sql, MYSQL_ASSOC)) { $update = $line['lastdone']; } $timesinceupdate = time() - $update; if ($timesinceupdate>=300) { $num_updates = floor($timesinceupdate / 300); //stock market stuff $result = mysql_query("SELECT * FROM `stocks`"); while($line = mysql_fetch_assoc($result)) { $amount = rand (strlen($line['cost']) * -1, strlen($line['cost'])); $newamount = $line['cost'] + $amount; if ($newamount < 1){ $newamount = 1; } $result2 = mysql_query("UPDATE `stocks` SET `cost`='".$newamount."' WHERE `id`='".$line['id']."'"); } //stock market stuff $result = mysql_query("SELECT * FROM `grpgusers`"); while($line = mysql_fetch_assoc($result)) { $updates_user = new User($line['id']); if ($updates_user->rmdays > 0) { $multiplier = 2; } else { $multiplier = 1; } $username = $updates_user->username; $newawake = $updates_user->awake + (5 * $num_updates) * $multiplier; $newawake = ($newawake > $updates_user->maxawake) ? $updates_user->maxawake : $newawake; $newhp = $updates_user->hp + (10 * $num_updates) * $multiplier; $newhp = ($newhp > $updates_user->maxhp) ? $updates_user->maxhp : $newhp; $newenergy = $updates_user->energy + (2 * $num_updates) * $multiplier; $newenergy = ($newenergy > $updates_user->maxenergy) ? $updates_user->maxenergy : $newenergy; $newnerve = $updates_user->nerve + (2 * $num_updates) * $multiplier; $newnerve = ($newnerve > $updates_user->maxnerve) ? $updates_user->maxnerve : $newnerve; $result2 = mysql_query("UPDATE `grpgusers` SET `awake` = '".$newawake."', `energy` = '".$newenergy."', `nerve` = '".$newnerve."', `hp` = '".$newhp."' WHERE `username` = '".$username."'"); } //update the timer and db $thetime = time(); $result2 = mysql_query("UPDATE `updates` SET `lastdone` = '".$thetime."' WHERE `name` = 'trevor'"); $leftovertime = $timesinceupdate - (floor($timesinceupdate / 300) * 300); if ($leftovertime>0) { $newupdate = time() - $leftovertime; $setleftovertime = mysql_query("UPDATE `updates` SET `lastdone` = '".$newupdate."' WHERE `name` = 'trevor'"); } } $updates_sql = mysql_query("SELECT * FROM `updates` WHERE `name` = 'hospital'"); while ($line = mysql_fetch_array($updates_sql, MYSQL_ASSOC)) { $update = $line['lastdone']; } $timesinceupdate = time() - $update; if ($timesinceupdate>=60) { $num_updates = floor($timesinceupdate / 60); $result = mysql_query("SELECT * FROM `grpgusers`"); //DO STUFF while($line = mysql_fetch_assoc($result)) { $result_user = mysql_query("SELECT * FROM `grpgusers` WHERE `id`='".$line['id']."'"); $updates_user = mysql_fetch_array($result_user); $newhospital = $updates_user['hospital'] - (60 * $num_updates); $newhospital = ($newhospital < 0) ? 0 : $newhospital; $newjail = $updates_user['jail'] - (60 * $num_updates); $newjail = ($newjail < 0) ? 0 : $newjail; $result2 = mysql_query("UPDATE `grpgusers` SET `hospital` = '".$newhospital."', `jail` = '".$newjail."' WHERE `id` = '".$line['id']."'"); } $result = mysql_query("SELECT * FROM `effects`"); while($line = mysql_fetch_assoc($result)) { if($line['timeleft'] > 0){ $newamount = $line['timeleft'] - (1 * $num_updates); $result2 = mysql_query("UPDATE `effects` SET `timeleft` = '".$newamount."' WHERE `id` = '".$line['id']."'"); } } $result2 = mysql_query("DELETE FROM `effects` WHERE `timeleft` < 1"); //update the timer and db $thetime = time(); $result2 = mysql_query("UPDATE `updates` SET `lastdone` = '".$thetime."' WHERE `name` = 'hospital'"); $leftovertime = $timesinceupdate - (floor($timesinceupdate / 60) * 60); if ($leftovertime>0) { $newupdate = time() - $leftovertime; $setleftovertime = mysql_query("UPDATE `updates` SET `lastdone` = '".$newupdate."' WHERE `name` = 'hospital'"); } } ?> Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted December 16, 2010 Share Posted December 16, 2010 Thats not connecting to the database so whatever the database info is stored in needs to be included Quote Link to comment Share on other sites More sharing options...
grant Posted December 16, 2010 Author Share Posted December 16, 2010 Thats not connecting to the database so whatever the database info is stored in needs to be includedsorry jordan i dont under stand im a little daft when it comes to this i will try find out wots wrong with it Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted December 16, 2010 Share Posted December 16, 2010 It's quite simple, If you are trying to get through the door what firstly do you need to do? open it.. Your trying to insert/select without opening the db connection Quote Link to comment Share on other sites More sharing options...
grant Posted December 16, 2010 Author Share Posted December 16, 2010 yes when i include the db i still have the same problem just 1 line now Fatal error: Class 'User' not found in /home/mafiawar/public_html/updates.php on line 69 Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted December 17, 2010 Share Posted December 17, 2010 What line is 63? and whats before it? Quote Link to comment Share on other sites More sharing options...
Djkanna Posted December 17, 2010 Share Posted December 17, 2010 How about including the class file too? Never worked with GRPG long enough to know it's files but the warning is a pretty good indication. Quote Link to comment Share on other sites More sharing options...
grant Posted December 17, 2010 Author Share Posted December 17, 2010 61 $result = mysql_query("SELECT * FROM `grpgusers`"); 65 while($line = mysql_fetch_assoc($result)) { 69 $updates_user = new User($line['id']); How about including the class file too? Never worked with GRPG long enough to know it's files but the warning is a pretty good indication. av give that a go see how it goes thanks Quote Link to comment Share on other sites More sharing options...
grant Posted December 17, 2010 Author Share Posted December 17, 2010 Fatal error: Cannot redeclare get_id() (previously declared in /home/mafiawar/public_html/classes.php:2) in /home/mafiawar/public_html/classes.php on line 6 Quote Link to comment Share on other sites More sharing options...
thebobby Posted December 17, 2010 Share Posted December 17, 2010 that startes it <? include 'dbcon.php'; include 'classes.php'; Quote Link to comment Share on other sites More sharing options...
thebobby Posted December 17, 2010 Share Posted December 17, 2010 wats on line 6 in classes.php Quote Link to comment Share on other sites More sharing options...
grant Posted December 17, 2010 Author Share Posted December 17, 2010 in classes.php <php function Get_ID($username){ $result = mysql_query("SELECT * FROM `grpgusers` WHERE `username` = '".$username."'"); $worked = mysql_fetch_array($result); return $worked['id']; } well thats wot in classes Quote Link to comment Share on other sites More sharing options...
thebobby Posted December 17, 2010 Share Posted December 17, 2010 this is how it looks 1 <?php 2 function Get_ID($username){ 3 $result = mysql_query("SELECT * FROM `grpgusers` WHERE `username` = '".$username."'"); 4 $worked = mysql_fetch_array($result); 5 return $worked['id']; 6 } 7 8 function mrefresh($url, $time="1"){ Quote Link to comment Share on other sites More sharing options...
grant Posted December 17, 2010 Author Share Posted December 17, 2010 1.<?php 2.function Get_ID($username){ 3.$result = mysql_query("SELECT * FROM `grpgusers` WHERE `username` = '".$username."'"); 4.$worked = mysql_fetch_array($result); 5.return $worked['id']; 6.} 7 8.function mrefresh($url, $time="1"){ 9.echo '<meta http-equiv="refresh" content="'.$time.';url='.$url.'">'; 10.} well it all the same here so wot mite be the problem any ideas ? Quote Link to comment Share on other sites More sharing options...
URBANZ Posted January 23, 2011 Share Posted January 23, 2011 if you still havet got this sorted it is a table or fild missing in the db and you dont use dbcon.php of classes file in update file as the update file is included on to header that already includes dbcon and classes Quote Link to comment 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.