VegasKiller Posted July 19, 2010 Share Posted July 19, 2010 Hello, My Name Is Michael C. I Am From Canada And Am New To This Amazing Forum And Coding. I Am A Beginner PHP Programmer And Would Appreciate All The Help With My Errors As I Can Get. The highest point holder when the errors are all fixed will get a very amazing award. ConflictChaos.com 1 Point StreetSyndicate 1 Point Quote Link to comment Share on other sites More sharing options...
VegasKiller Posted July 19, 2010 Author Share Posted July 19, 2010 First Error First Error. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 25 Line 25: mysql_query("INSERT INTO fedjail VALUES('',$r['userid'],5,1,'Failed To Validate Account Randomly') WHERE $r['screwups']>4",$c); If you can also tell me what i did wrong it may help future T String errors from occurring thanks. Quote Link to comment Share on other sites More sharing options...
Danny696 Posted July 19, 2010 Share Posted July 19, 2010 Whats line 24? Quote Link to comment Share on other sites More sharing options...
VegasKiller Posted July 19, 2010 Author Share Posted July 19, 2010 Whats line 24?/// Validation Starts Here /// mysql_query("UPDATE users SET validated=validated-1 WHERE validated>0",$c); mysql_query("UPDATE users SET validated=0 WHERE validated<0",$c); *24* mysql_query("UPDATE users SET fedjail=1 WHERE screwups>4",$c); *25* mysql_query("INSERT INTO fedjail VALUES('',$r['userid'],5,1,'Failed To Validate Account Randomly') WHERE $r['screwups']>4",$c); mysql_query("UPDATE users SET screwups=0 WHERE screwups>4",$c); /// Validation Ends Here /// Quote Link to comment Share on other sites More sharing options...
Equinox Posted July 19, 2010 Share Posted July 19, 2010 mysql_query("INSERT INTO `fedjail` VALUES('',".$r['userid'].",5,1,'Failed To Validate Account Randomly') WHERE (`screwups` > 4)", $c); Quote Link to comment Share on other sites More sharing options...
VegasKiller Posted July 19, 2010 Author Share Posted July 19, 2010 Yayyy. Thank You So Much. The Error Is Gone. :) Quote Link to comment Share on other sites More sharing options...
VegasKiller Posted July 19, 2010 Author Share Posted July 19, 2010 Second Error. The weather is not changing. Please help me... <?php include "mysql.php"; global $c; /// Word War Packs Starts Here /// mysql_query("UPDATE users SET wknd_1_hours=wknd_1_hours-1 WHERE wknd_1_hours > 0",$c); mysql_query("UPDATE users SET wknd_2_hours=wknd_2_hours-1 WHERE wknd_2_hours > 0",$c); mysql_query("UPDATE users SET wknd_3_hours=wknd_3_hours-1 WHERE wknd_3_hours > 0",$c); /// World War Packs End Here /// /// Rehab Starts Here /// $q = mysql_query("SELECT * FROM `drug`",$c); while($r=mysql_fetch_array($q)) { $q2 = mysql_query("SELECT * FROM `users` WHERE `userid` = '{$r['user']}'",$c); $r2=mysql_fetch_array($q2); if($r2['hospital'] > 0 and $r2['rehab'] > 0) { mysql_query("DELETE FROM `drug` WHERE `user` = '{$r2['userid']}'",$c); } /// Rehab Ends Here /// /// Weather Starts Here /// $wi=mysql_query("SELECT ws.*,w.* FROM weather_status ws LEFT JOIN weathers w ON ws.weather=w.w_id LIMIT 1;",$c); $w=mysql_fetch_array($wi); if($w['remaining_minutes'] == 0) { $weather=mysql_fetch_array(mysql_query("SELECT * FROM weathers ORDER BY rand() LIMIT 1;",$c)); $chance=rand(1,$weather['w_chance']*20); if($weather['w_chance'] < $chance) { $weather=mysql_fetch_array(mysql_query("SELECT * FROM weathers ORDER BY rand() LIMIT 1;",$c)); } $chance=rand(1,$weather['w_chance']*20); if($weather['w_chance'] < $chance) { $weather=mysql_fetch_array(mysql_query("SELECT * FROM weathers ORDER BY w_chance DESC LIMIT 1;",$c)); } $w2c=$weather['w_id']; mysql_query("UPDATE weather_status SET weather={$w2c} LIMIT 1;",$c); } } print mysql_affected_rows($c)." affected rows during this query. "; /// Weather Ends Here /// /// Hunger Starts here /// mysql_query("UPDATE users SET hunger=hunger+(maxhunger/72) WHERE hunger < maxhunger AND donatordays = 0 AND wknd_1_hours = 0 AND wknd_2_hours = 0 AND wknd_3_hours = 0",$c); mysql_query("UPDATE users SET hunger=hunger+(maxhunger/96) WHERE hunger < maxhunger AND donatordays > 0",$c); mysql_query("UPDATE users SET hunger=hunger+(maxhunger/120) WHERE hunger < maxhunger AND wknd_1_hours > 0",$c); mysql_query("UPDATE users SET hunger=hunger+(maxhunger/144) WHERE hunger < maxhunger AND wknd_2_hours > 0",$c); mysql_query("UPDATE users SET hunger=hunger+(maxhunger/144) WHERE hunger < maxhunger AND wknd_3_hours > 0",$c); mysql_query("UPDATE users,userbodytype SET users.hunger=users.hunger+(users.maxhunger/24) WHERE users.hunger < users.maxhunger AND users.userid=userbodytype.userid AND userbodytype.vampire = 1",$c); mysql_query("UPDATE users SET bodyfat=bodyfat-1 WHERE hunger > maxhunger",$c); mysql_query("UPDATE users SET hospital='120' hospreason='Suffering From Starvation' WHERE bodyfat = -6",$c); mysql_query("UPDATE users SET hunger=0 WHERE bodyfat = -6",$c); mysql_query("UPDATE users SET bodyfat=0 WHERE bodyfat = -6",$c); mysql_query("UPDATE users SET hunger=maxhunger WHERE hunger > maxhunger",$c); /// Hunger Ends Here /// ?> Quote Link to comment Share on other sites More sharing options...
ddgamedesign Posted July 19, 2010 Share Posted July 19, 2010 $query8="UPDATE users SET hospital='120', hospreason='Suffering From Starvation' WHERE bodyfat = -6"; Add the comma after ='120'? Each separate variable that updates needs a comma separating it usually. Quote Link to comment Share on other sites More sharing options...
VegasKiller Posted July 19, 2010 Author Share Posted July 19, 2010 $query8="UPDATE users SET hospital='120', hospreason='Suffering From Starvation' WHERE bodyfat = -6"; Add the comma after ='120'? Each separate variable that updates needs a comma separating it usually. Thank you, I did not even see that. Point for you. :) Quote Link to comment Share on other sites More sharing options...
VegasKiller Posted July 20, 2010 Author Share Posted July 20, 2010 Third Error. Weather And Rehab Is Not Updating/Changing. Code... /// Rehab Starts Here /// $q = mysql_query("SELECT * FROM drug",$c); while($r=mysql_fetch_array($q)) { $q2 = mysql_query("SELECT * FROM users WHERE userid = '{$r['user']}'",$c); $r2=mysql_fetch_array($q2); if($r2['hospital'] > 0 and $r2['rehab'] > 0) { mysql_query("DELETE FROM drug WHERE user = '{$r2['userid']}'",$c); } /// Rehab Ends Here /// /// Weather Starts Here /// $wi=mysql_query("SELECT ws.*,w.* FROM weather_status ws LEFT JOIN weathers w ON ws.weather=w.w_id LIMIT 1;",$c); $w=mysql_fetch_array($wi); if($w['remaining_minutes'] == 0) { $weather=mysql_fetch_array(mysql_query("SELECT * FROM weathers ORDER BY rand() LIMIT 1;",$c)); $chance=rand(1,$weather['w_chance']*20); if($weather['w_chance'] < $chance) { $weather=mysql_fetch_array(mysql_query("SELECT * FROM weathers ORDER BY rand() LIMIT 1;",$c)); } $chance=rand(1,$weather['w_chance']*20); if($weather['w_chance'] < $chance) { $weather=mysql_fetch_array(mysql_query("SELECT * FROM weathers ORDER BY w_chance DESC LIMIT 1;",$c)); } $w2c=$weather['w_id']; mysql_query("UPDATE weather_status SET weather={$w2c} LIMIT 1;",$c); mysql_query("UPDATE weather_status SET remaining_minutes=rand(1,60)",$c); } } print mysql_affected_rows($c)." affected rows during this query. "; /// Weather Ends Here /// Also I do not see where it would update the remaining minutes for the new weather status. Should it be entering a random minutes remaining when the weather changes? And should this weather code be in the 1 minute cron instead of the 1 hour cron? I get this print out when i run this code. -1 affected rows during this query. 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.