douquanjie9326 2009-06-08 01:19
浏览 37
已采纳

PHP:在MDB2中使用MYSQL对字符串使用quote()

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

  • 写回答

1条回答 默认 最新

  • douzhicui2209 2009-06-08 01:21
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 CATIA有些零件打开直接单机确定终止
  • ¥15 请问有会的吗,用MATLAB做
  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 ARIMA模型时间序列预测用pathon解决
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序,怎么查看客户esp32板子上程序及烧录地址