Jump to content

get_magic_quotes_gpc() drives me crazy


robert_gsfame

Recommended Posts

I have retrieved some data from one table to be inserted into another table using this query

$sql=mysql_query("SELECT * FROM table WHERE id='1'");

$array=mysql_fetch_array($sql);

$name=$array['name'];                  * Let say i have $name=  james"king"

 

function clean($string) {

    if(get_magic_quotes_gpc()) {

        return stripslashes($string);

    }else{

    return $string;

    }

}

 

mysql_query(sprintf("INSERT INTO table2(name, age)VALUES('%s','%s')",

mysql_real_escape_string($name),

mysql_real_escape_string($_POST['age']));

 

Let say if $_POST['age']=  "25"          * double quotes also included

 

then i will have result like this in table2:

name= NULL

age=    "25"

 

 

Link to comment
https://forums.phpfreaks.com/topic/189798-get_magic_quotes_gpc-drives-me-crazy/
Share on other sites

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.