PDA

View Full Version : Can't execute a REPLACE command on my databases...


mallaire
07-21-2003, 05:37 PM
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
07-22-2003, 12:10 AM
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
07-23-2003, 12:34 AM
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:

$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:
mysql_real_escape_string($_GET['variable'])

Depending on who has access to the database... don't want anyone hacking their way in ;)

John