Jump to content
MakeWebGames

Weather Not Updating, Please Help


Recommended Posts

When I run my page I get this print out.

-1 affected rows during this query.

 

also my weather is not updating correctly. The time remaining stays at 0 always, And it is always raining, I think ive seen it snowing once so it may change the weather but not the time remaining. Pls help me get this working as it is a major thing in my game. thnx

 

/// Weather Starts Here ///

mysql_query("UPDATE weather_status SET remaining_minutes=remaining_minutes-1 WHERE remaining_minutes>0",$c);

$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) WHERE remaining_minutes=0",$c);

}

print mysql_affected_rows($c)." affected rows during this query.

";

/// Weather Ends Here ///

also in my header. I put my mouse over the weather icon and it says for next 0 minutes. so it is not showing the type of weathers name.

 

$ws=mysql_query("SELECT * FROM weather_status",$c);

$rws=mysql_fetch_array($ws);

$tws=mysql_query("SELECT * FROM weathers",$c);

$fws=mysql_fetch_array($tws);

echo "<td valign='right' width='60'>weather_{$rws[

?(

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...