Monk3h Posted April 26, 2008 Share Posted April 26, 2008 if ($step == upgrade) { if ($stat[bank] < $bankmin) { Print "You do not have the required funds in your account to Upgrade! Please transfer the required funds!"; }else{ mysql_query("update players set bankaccount=$newbank[name] where id=$stat[id]"); Print "You have successfully upgraded your account to our $newbank[name]"; }} Can anyone tell me why this isnt working? Its displaying the text when i upgrade saying iv upgraded. But it dosnt change the bankaccount feild in Players to the new Bank account. :s Quote Link to comment Share on other sites More sharing options...
moselkady Posted April 26, 2008 Share Posted April 26, 2008 You should enclose array elements in braces if you use them within a string. Try changing your sql to the following and see how it goes: mysql_query("update players set bankaccount={$newbank['name']} where id={$stat['id']}"); Quote Link to comment Share on other sites More sharing options...
Monk3h Posted April 26, 2008 Author Share Posted April 26, 2008 Done.. Still not Working. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted April 26, 2008 Share Posted April 26, 2008 Whenever you are having problems with a query there should always be two things you do before anything else... 1) echo out your query... $query = "update players set bankaccount=$newbank[name] where id=$stat[id]"; echo $query; mysql_query($query); 2) show the mysql error(s)... $query = "update players set bankaccount=$newbank[name] where id=$stat[id]"; echo $query; mysql_query($query) or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
Monk3h Posted April 26, 2008 Author Share Posted April 26, 2008 update players set bankaccount=Bronze Account where id=2You have successfully upgraded your account to our Bronze Account So that should work. Thats exactly what i want it to do.. WTF!? Quote Link to comment Share on other sites More sharing options...
Monk3h Posted April 26, 2008 Author Share Posted April 26, 2008 Could it have somthing to do with the account name having a spcae in it? Do i need to use a diferent Query? Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted April 26, 2008 Share Posted April 26, 2008 A string must be quoted in an sql query... bankaccount='Bronze Account' Quote Link to comment Share on other sites More sharing options...
MadTechie Posted April 27, 2008 Share Posted April 27, 2008 try $query = "update players set bankaccount='{$newbank['name']}' where id={$stat['id']}"; mysql_query($query) or die($query.mysql_error()); Quote Link to comment Share on other sites More sharing options...
Monk3h Posted April 27, 2008 Author Share Posted April 27, 2008 Thanks guys, i added in the '/' and it works now. XD Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.