VegasKiller Posted July 20, 2010 Share Posted July 20, 2010 Weather Is Not Updating/Changing. Code... /// 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.