Hybridd Posted December 18, 2014 Share Posted December 18, 2014 im having trying to put things in the members table on the database. the code im using is: mysql_query("UPDATE `members` SET `my_points` = '25', `my_dondays` = '8', `wallet` + '50000',`gift` = 1 WHERE `playerid` = {$playerid}"); i_credit($playerid, 79, 3); iv tried this. $ddays = 8; $udays = $pl['my_dondays'] + $ddays; $wallet = 50000; $uwallet = $pl['wallet'] + $wallet; $points = 25; $upoints = $pl['my_points'] + $points; mysql_query("UPDATE `members` SET `my_points` = '$points', `my_dondays` = '$ddays', `wallet` + '$wallet',`gift` = 1 WHERE `playerid` = {$playerid}"); i_credit($playerid, 79, 3); basically the problem is that its not updating the tables. Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted December 18, 2014 Share Posted December 18, 2014 wallet = wallet + 50000; Quote Link to comment Share on other sites More sharing options...
Hybridd Posted December 18, 2014 Author Share Posted December 18, 2014 that would work kyle but the error was in this bit: {$playerid}. i fixed it by replacing it with {$_SESSION['playerid']} mysql_query("UPDATE `members` SET `my_points` ='".$upoints."', `my_dondays` ='".$udays."', `my_maxenergy`= '150', `my_energy`= '150', `wallet` ='".$uwallet."',`gift` = 1 WHERE `playerid` = {$_SESSION['playerid']}"); Quote Link to comment Share on other sites More sharing options...
NonStopCoding Posted December 18, 2014 Share Posted December 18, 2014 that would work kyle but the error was in this bit: {$playerid}. i fixed it by replacing it with {$_SESSION['playerid']} mysql_query("UPDATE `members` SET `my_points` ='".$upoints."', `my_dondays` ='".$udays."', `my_maxenergy`= '150', `my_energy`= '150', `wallet` ='".$uwallet."',`gift` = 1 WHERE `playerid` = {$_SESSION['playerid']}"); i told you yesterday if you are going to use the $playerid variable you need to set it in the style top Quote Link to comment Share on other sites More sharing options...
Hybridd Posted December 18, 2014 Author Share Posted December 18, 2014 my bad.. at least its working now:cool: Quote Link to comment Share on other sites More sharing options...
jcvenom Posted December 19, 2014 Share Posted December 19, 2014 [b]Firstly declare[/b] $playerid;[b] in your styletop or header[/b] $playerid = $_SESSION['playerid']; [b]or if it in a switch function declare the variable[/b] $playerid = $_SESSION['playerid'];[b] outside the function and call it using "global".[/b] $playerid = $_SESSION['playerid']; //Variable assigned to session switch($_GET['whatever']) { case 'index': index(); break; default: index(); break; } function index(){ global $playerid; } [b]And you where missing `wallet`as kyle stated[/b] mysql_query("UPDATE `members` SET `my_points` = '25', `my_dondays` = '8', `wallet` = `wallet` + '50000',`gift` = 1 WHERE `playerid` = {$playerid}"); i_credit($playerid, 79, 3); - - - Updated - - - [b]Firstly declare[/b] $playerid; [b]in your styletop or header[/b] $playerid = $_SESSION['playerid']; //Variable assigned to session [b]or if its in a switch function declare the variable[/b]$playerid = $_SESSION['playerid']; [b] outside the function and call it using "global".[/b] $playerid = $_SESSION['playerid']; //Variable assigned to session switch($_GET['whatever']) { case 'index': index(); break; default: index(); break; } function index(){ global $playerid; //Fetches variable from outside the function } [b]And you where missing `wallet`as kyle stated[/b] mysql_query("UPDATE `members` SET `my_points` = '25', `my_dondays` = '8', `wallet` = `wallet` + '50000',`gift` = 1 WHERE `playerid` = {$playerid}"); i_credit($playerid, 79, 3); Hope this helps. Quote Link to comment Share on other sites More sharing options...
Legaci Posted December 23, 2014 Share Posted December 23, 2014 Firstly, JCVenom why using $_SESSION when thats already declared with $pl in style_top Just sloppy not using something if its already declared. Secondly, Hybridd When adding to a column that already exists such as `wallet`, `my_points`, my_maxenergy & my_dondays you want to set the column you using first IE `wallet` = `wallet`<<--(your first figure) + 100 you also dont need to put these ' around numbers. hope this helps for the future!! Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted December 23, 2014 Share Posted December 23, 2014 Firstly, JCVenom why using $_SESSION when thats already declared with $pl in style_top Just sloppy not using something if its already declared. Secondly, Hybridd When adding to a column that already exists such as `wallet`, `my_points`, my_maxenergy & my_dondays you want to set the column you using first IE `wallet` = `wallet`<<--(your first figure) + 100 you also dont need to put these ' around numbers. hope this helps for the future!! Putting quotes around numbers is not entirely true. There are some instances that I have seen where the datatype is enum which is represented by a string and not an INT which you would need to put a quote around the data Quote Link to comment Share on other sites More sharing options...
jcvenom Posted December 23, 2014 Share Posted December 23, 2014 Firstly, JCVenom why using $_SESSION when thats already declared with $pl in style_top Just sloppy not using something if its already declared. Secondly, Hybridd When adding to a column that already exists such as `wallet`, `my_points`, my_maxenergy & my_dondays you want to set the column you using first IE `wallet` = `wallet`<<--(your first figure) + 100 you also dont need to put these ' around numbers. hope this helps for the future!! I actually didn't realize it was declared in the style_top, that was simply a mistake Quote Link to comment Share on other sites More sharing options...
Legaci Posted December 27, 2014 Share Posted December 27, 2014 I actually didn't realize it was declared in the style_top, that was simply a mistake You owned a version of this game :) any way i hope we helped ;) Quote Link to comment Share on other sites More sharing options...
jcvenom Posted December 27, 2014 Share Posted December 27, 2014 You owned a version of this game :) any way i hope we helped ;) I know :) Havent coded since Quote Link to comment Share on other sites More sharing options...
rockwood Posted February 18, 2015 Share Posted February 18, 2015 Mccodes is highly painful Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted February 18, 2015 Share Posted February 18, 2015 This isn't MCCode anyways [MENTION=65743]rockwood[/MENTION] 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.