Jump to content
MakeWebGames

Weather Cron Problems


Recommended Posts

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...