Jump to content

zyklon

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by zyklon

  1. i'll try that, thank you.
  2. I'm guessing my problem in the script resides in the second linee with my coding. Either i have to find a way to fix that or make a loop in php, which would stink.Do you think it might be all the ` and ' not in the right spots?
  3. i reran it in sql and it said it ran succesfully i had previously entered in wrong in phpmyadmin, bu the ranking part didnt work. it just gives them there numbeer depending on where they are in the table.
  4. ya, and may cause the page to run very slow....
  5. that is ranking script, it is ranking the players and the rank is the only thing being changed for everyone, this is my cron script. i will run it on phpmyadmin, i am using phpdev423 to dev, and will either use an old linux machine or another computer with wamp on it.edit: i ran a test in phpmyadmin it said error in first line.
  6. i'm not sure if it ever worked...i thought it was once, and just to help... heres the structures of the table:so remove all of the ` out of the code ## Table structure for table `cron`#CREATE TABLE cron ( minutes int(2) NOT NULL default '0', id int(1) NOT NULL default '0') TYPE=MyISAM;____________________________________## Table structure for table `user`#CREATE TABLE user ( username varchar(60) NOT NULL default '', password varchar(32) NOT NULL default '', email varchar(60) NOT NULL default '', troops int(10) NOT NULL default '1', generals int(10) NOT NULL default '0', turns int(10) NOT NULL default '10', gold int(10) NOT NULL default '100', land int(10) NOT NULL default '100', power int(10) NOT NULL default '0', rank int(10) NOT NULL default '0', id int(4) NOT NULL auto_increment, new tinyint(1) NOT NULL default '1', arm tinyint(1) NOT NULL default '1', PRIMARY KEY (id)) TYPE=MyISAM;
  7. nothing, thats the problem, it reports no errors at all even in errors.txt, it just doesnt work, it 's the weirdest thing, thats why i am looking for help.
  8. A part of my code which is supposed to do the ranking in the game i have been making isnt working Here is the code: <?php include'config.php'; $minutes = mysql_result(mysql_query("SELECT * FROM `cron` WHERE id = '1'"),0,"minutes"); if($minutes) { $minutes--; mysql_query("UPDATE `cron` SET `minutes`='$minutes' WHERE id = '1'") or die("MySQL ERROR: ".mysql_error()); } else { mysql_query("UPDATE `cron` SET `minutes`='4' WHERE `id` = '1'") or die("MySQL ERROR: ".mysql_error()); mysql_query("UPDATE `user` SET `gold`=`gold`+ROUND(`land`/2),`turns`=`turns`+1, `power`=ROUND(`gold`/1000 + `troops`*100 + `land` + `generals`*20)") or die("MySQL ERROR: ".mysql_error()); mysql_query("SET @i:=0") or die("MySQL ERROR: ".mysql_error()); mysql_query("UPDATE `user` SET `rank`=(@i:=@i+1) ORDER BY `power` DESC") or die("MySQL ERROR: ".mysql_error()); } ?> These are the line of the code that are seemingly failing/not working: mysql_query("SET @i:=0") or die("MySQL ERROR: ".mysql_error()); mysql_query("UPDATE `user` SET `rank`=(@i:=@i+1) ORDER BY `power` DESC") or die("MySQL ERROR: ".mysql_error()); It also didnt work when it was like this: mysql_query("SET @i=0") or die("MySQL ERROR: ".mysql_error()); mysql_query("UPDATE `user` SET `rank`=(@i:=@i+1) ORDER BY `power` DESC") or die("MySQL ERROR: ".mysql_error()); Anyways cant wait until this is figured out the game is going to be a Turn/tick-based mmorpg!
×
×
  • Create New...