Hi.
I have this scripts to update my database totals:
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:
Should I be using ' or ` perhaps? Also, is the "userid = '1' " just how the error reports?
Any pointers would be great!
I have this scripts to update my database totals:
PHP:
while ($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;
[COLOR=red] $mppayme=mysql_query("UPDATE members SET tottokens = tottokens+$mpmylo, tokens=tokens+$mpmylo, newtokens = newtokens+$mpmylo, bonus = bonus+$mpplancost[/color]
[COLOR=red] WHERE userid = '1002' LIMIT 1")or die(mysql_error());[/color]
$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:
screen said: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!