Jump to content

help me i've bought a sever and my websites page dont work.


Orionsbelter

Recommended Posts

hi, i bought my own V.D sever and don't really know much about them. but now some pages aren't woking some of the php wont work, here is some coding that wont work.

$fetch=mysql_fetch_object(mysql_query("SELECT * FROM user_info WHERE username='$username'"));
$new_money=$fetch->points + 10000;
mysql_query("UPDATE user_info SET points='$new_money' WHERE username='$username'");

no errors come up it just doesn't work what is the problem is they something i need to change in the php.ini file?  does something need installing? please help me thanks

 

So, does this code work on your local development system and but not on the live server? You should develop and debug code on a development system to get it working before you ever put it on a live server as code in the development stage often has security holes that would let someone take over a server.

 

Did you ever manage to get both the error_reporting level set to at least E_ALL (you should include E_STRICT to help avoid using php functions that are depreciated and will be eliminated in future versions) and display_errors turned on and verified that these settings were in effect at runtime using a phpinfo(); statement?

 

The posted code (which I am pretty sure you did not write, but desperately want to get running) was written with no error checking, error reporting, or error recovery logic. Basically it would earn a "C-" in a programming class. So, it is not checking if an error occurred, it is not outputting a meaningful message when an error occurs and it is not logging the full information about what did happen, nor is doing anything appropriate to recover when an error occurs, like preventing the following logic from blindly attempting to use non-existent data.

 

You can find how to add basic error checking by reading the mysql_query() section in the php manual, reading a good php/mysql book, or searching any php help forum (there were about 60 posts in the last 30 days on this forum where people had mysql_query() statements without error checking that found what their problem was by adding some basic error checking.)

 

P.S. The three lines of code can be replaced by a single UPDATE statement.

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.