duanniwu7730 2011-10-19 15:39
浏览 84

where子句中的Php / SQL / DB2特殊字符

I am trying to SQL a DB2 database (on an iSeries) using PHP and "DB2_exec"- not mysql.

I have these characters in my WHERE clause (variable $EncSSN) which cause the SQL statement to stop: ðIn*Éæng “"Ò×ÑRÈ•`

The SQL is constructed as:

select EENUM, EESSN 
from EEMAST 
where EESSN = '$EncSSN'

The field in the table EESSN contains encrypted values. - I get no errors and no log entries. The html renders a blank page. - I have tried replacing (str_replace) quotes, single quotes, period, etc with escape character '\' - I can't use mysql_real_escape_string because I am loading the db2_connect resource.

If I change the SQL statement above's where to select a value from a different field, my html is rendered properly.

Can you think of anyway I can accomplish this?

Steven

  • 写回答

2条回答 默认 最新

  • dongnaota6386 2011-10-19 16:12
    关注

    try the addslashes() function http://php.net/manual/en/function.addslashes.php

    or heredoc or nowdoc syntax http://php.net/manual/en/language.types.string.php

    you could also put the sql in a stored proc, but you may have the same issues for the parameter value and need to try one of the above.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度