Tmal Posted July 22, 2009 Share Posted July 22, 2009 Hey Ive gone thru my code about 100 times and I cant find any errors but its not echoing the information as it is supposed to, can anyone take a look and see if I did something wrong? Thanks for any views and reply's <?php if($_GET['type']=="untrained"){ $ammount = $_GET['ammount']; $troops = ($ammount * 1500); $sql = "SELECT * FROM `UserInfo` WHERE `id` = '$id'"; $row = mysql_fetch_array(mysql_query($sql)); if($row['id'] != $id){ $msg=("HACK ATTEMPT DETECTED!"); echo($msg); } else{ $tokens = $row['tokens']; if($tokens >= $ammount){ $update="UPDATE `EmpireBank` SET `Untrained` = `Untrained` +'$troops' WHERE `owner` = '$id'"; $update2="UPDATE `UserInfo` SET `tokens` = `tokens` -'$ammount' WHERE `id` = '$id'"; $res=mysql_query($update); $res2=mysql_query($update2); if(isset($res) && isset($res2)){ $msg=("You have just bought ".number_format($troops)." untrained for ".number_format($ammount)." ULC Tokens"); echo($msg); }else{ $msg="Something Went Awfully Wront :S"; echo $msg; } }else{ $msg=("Not enough ULC Tokens"); echo($msg); } } } ?> Link to comment https://forums.phpfreaks.com/topic/166929-solved-can-someone-check-my-code-please/ Share on other sites More sharing options...
mmarif4u Posted July 22, 2009 Share Posted July 22, 2009 Did you get any error? Try this: if(isset($res) && isset($res2)){ to this: if($res && $res2){ You better use error tracking for script and queries like: At top of the script: error_reporting (E_ALL); And for query: $res=mysql_query($update) or die (mysql_error()); Link to comment https://forums.phpfreaks.com/topic/166929-solved-can-someone-check-my-code-please/#findComment-880143 Share on other sites More sharing options...
Tmal Posted July 22, 2009 Author Share Posted July 22, 2009 Its works now Thank you very much! Link to comment https://forums.phpfreaks.com/topic/166929-solved-can-someone-check-my-code-please/#findComment-880149 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.