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 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题