Jump to content

sever error, wont do plus sums +


Orionsbelter

Recommended Posts

hi i have recently bought a sever and dont know much about them but noticed now i've moved my website onto my own sever it wont do the following:

$user=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));

$newcash=1000;
////////// here is where is doesn't work it doesn't add these together
$newmoney=$user->money + $newcash;
mysql_query("UPDATE users SET money='$newmoney' WHERE username='$username'");

however it will do this:
////// it'll minus the money just dont add it.
$newmoney=$user->money - $newcash;
mysql_query("UPDATE users SET money='$newmoney' WHERE username='$username'");


and it'll do this:
mysql_query("UPDATE users SET money=money+$newcash WHERE username='$username'");

this worked perfectly on my hosting account now i have my own sever it seems to be a problem what dod i need to configure to make it work? thanks 

Link to comment
https://forums.phpfreaks.com/topic/108794-sever-error-wont-do-plus-sums/
Share on other sites

The only reasonably way that would fail is if the values were close to the limit that could be held in a variable or in your column in your table. Show what the actual values are that don't work. What are $newmoney and $user->money when you echo them?

 

If they echo correctly, post your table definition.

 

Also, you don't state exactly what it is doing? Is there a php or mysql error? Does the value stay the same? Does the value change but is not correct?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.