Re: MDB2 autoExecute escaping data

From: Date: Sun, 07 Oct 2007 16:10:42 +0000
Subject: Re: MDB2 autoExecute escaping data
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-28065@lists.php.net to get a copy of this message
Mark Steudel wrote:
I think I'm checking for that, here's the code I am running: // convert to html entities $html = htmlentities( $_POST['content'], ENT_QUOTES ); // check if magic quotes gpc is on, remove slashes if( get_magic_quotes_gpc() ) {
    $data = stripslashes( $html);
} // then use real escape function $html= mysql_real_escape_string( $html); $field_values['content'] = $html; $mdb->autoExecute( 'tableName', $field_values );
Don't pass your data to mysql_real_escape_string(). The MDB2 wrapper will handle escaping/quoting. When using a DB wrapper one should generally avoid mixing in database-specific function calls. brian

« previous php.pear.general (#28065) next »