Can't execute a REPLACE command on my databases...

mallaire

Verified User
Joined
Jul 5, 2003
Messages
28
Location
Montreal, Canada
Does anyone knows why I cannot execute a REPLACE command on my databases.

All my scripts were working fine, and after switching to the new server (which is working with Direct Admin), my scripts are not replacing the data anymore...

Should I activate a permission somewhere?

Does anyone experienced this in the past?

Here's my code:
$sql = "REPLACE INTO website (PAGEID,TITLEFR,TITLEEN) VALUES ('$PAGEID','$TITLEFR','$TITLEEN')";

Thanks for your help... :)
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,907
Hello,

I do not believe that REPLACE is one of the commands set to be GRANTed to a db user when created. I'll check to make sure its not a super user command (never used it myself), and if not, I can add it to the list of commands (along with SELECT, DELETE..etc)

John
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,907
Hello,

After playing around a bit, I've realized that the REPLACE command is already active for user accounts.

You should be able to execute it.. I would suspect that the register_globals=off might be causing your problems... I'm not sure if you're passing those variables straight from a GET or POST, but if you are, try this:

Code:
$sql = "REPLACE INTO website (PAGEID,TITLEFR,TITLEEN) VALUES ('",$_GET['PAGEID'],"','"$_GET['TITLEFR'],"','",$_GET['TITLEEN'],"')";
This will take the value from the GET array with register globals as off... you also might want to look into using:
Code:
mysql_real_escape_string($_GET['variable'])
Depending on who has access to the database... don't want anyone hacking their way in ;)

John
 
Top