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
Share on other sites

Have you moved to a different version of php?

 

You may need to check this as sites built on one version can break on differnent ones (particularly with classes from php 5-> 4 as 4 doesn't support "public" "private")

Link to comment
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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.