FreePgs.com Forum

FreePgs Related => Support Requests => Topic started by: Ries on January 23, 2006, 01:11:47 PM

Title: Reset Script
Post by: Ries on January 23, 2006, 01:11:47 PM
Hi, I made a Reset Script to be run by a Cronjob and the script is
<?php

mysql_connect ("localhost", "eluxian", "****") or die ('I cannot connect to the database because: ' . mysql_error());
   mysql_select_db ("eluxian");

mysql_query("UPDATE userdb SET energy_max='10'")or die(mysql_error());
$result = mysql_query("UPDATE userdb SET energy_now=energy_max")or die(mysql_error());

$result = mysql_query($sql);
?>
P.S the password is really like that i hashed it out for the post

But it doesn't work, its supposed to set energy_now to energy_max but it doesn't work. But it did the other way around.
I have checked the connection line with pass and user thats fine, the db is fine and the tables are fine also the collums are in the db but it doesn't work, Any ideas?
Title: Re: Reset Script
Post by: Ries on January 25, 2006, 04:56:58 PM
cant any1 help me?
Title: Re: Reset Script
Post by: Ries on January 25, 2006, 07:45:22 PM
I fixed it, its fine now
Title: Re: Reset Script
Post by: sixthcrusifix on January 26, 2006, 02:41:22 AM
Quote from: Ries on January 25, 2006, 07:45:22 PM
I fixed it, its fine now

An alternative to your orginal method would be to use mysql_fetch_array to get teh value of energy_max into a variable and then set energy_now to that value. :D
}