Question

I'm using Pear's MDB2 and really enjoying it, but there is something that is starting to annoy me. I build the SQL string in the following way, using the quote method of the mdb2 package:

$sql = sprintf("INSERT INTO profiles(email, fullName) VALUES(%s,%s)", 
                     $mdb2->quote($email), $mdb2->quote($fullName));

(as explained in the example on this page: http://pear.php.net/manual/en/package.database.mdb2.intro-quote.php)

and everything looks nice in the database. But when I extract data from the database, still using MDB2 I can't seem to find an easy way of stripping the quoting added by the quote method. At the moment I am using the stripslashes, but this doesn't seem right. Am I missing a setting somewhere? I am I using the package in the wrong way?

Thank you for you help, Leif

Was it helpful?

Solution

I've found that turning off magic_quotes_gpc, and magic_quotes_runtime, to be the best approach. In fact, as of 5.3.0 these directives have been deprecated. In 6.0 they have been removed all together.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top