|
max2474 (Programmer) |
1 Jun 12 11:44 |
Hi. I have this scripts to update my database totals: CODE --> phpwhile ($mppaycount <= 8)
{
$mpref=$_SESSION[refs][$mppaycount];
$mprefpay=$_SESSION[refpay][$mppaycount];
$mppayrefs=mysql_query("UPDATE members SET tottokens = tottokens+$mprefpay, tokens = tokens+$mprefpay, newtokens = newtokens+$mprefpay
WHERE userid = '$mpref' LIMIT 1");
$mppayrefs=mysql_query("UPDATE members SET tottokens = tottokens+$mprefpay, tokens = tokens+$mprefpay, newtokens = newtokens+$mprefpay
WHERE userid = '1001' LIMIT 1");
paylvlbonus($mpref,$mprefpay);
$mppaycount++;
}
$mpmylo=$_SESSION[myleftovers];
$mpmpb=$_SESSION[misspaymentbonus];
$mpboth=$mpmylo+$mpmpb;
$mppayme=mysql_query("UPDATE members SET tottokens = tottokens+$mpmylo, tokens=tokens+$mpmylo, newtokens = newtokens+$mpmylo, bonus = bonus+$mpplancost
WHERE userid = '1002' LIMIT 1")or die(mysql_error());
$mppayme=mysql_query("UPDATE members SET tottokens = tottokens+$mpmpb, tokens=tokens+$mpmpb, newtokens = newtokens+$mpmpb
WHERE userid = '1003' LIMIT 1");
$mppayme=mysql_query("UPDATE members SET tottokens = tottokens+$mpboth, tokens=tokens+$mpboth, newtokens = newtokens+$mpboth
WHERE userid = '1001' LIMIT 1"); everything seemed to be working fine until I deleted the test database and started again. I have noticed that upon the first run ONLY, that the highlighted line wasnt adding the bonus. (bonus = bonus+$mpplancost) yet all else is working fine. Upon a repeated call, the value $mpplancost does get added. Adding the "or die(mysql_error()" gives the following error: Quote (screen) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' tokens=tokens+, newtokens = newtokens+, bonus = bonus+5500 WHERE userid = '1' at line 1
Should I be using ' or ` perhaps? Also, is the "userid = '1' " just how the error reports? Any pointers would be great! |
|