douliu7929 2012-03-29 19:09
浏览 40
已采纳

如何在Oracle中插入PHP中的特殊字符?

I want to insert data with special character in oracle tables. My code is like this-:

$query1 ="INSERT INTO sample(po_number , created_at , customer_firstname , customer_lastname , customer_email , 
shipping_description , ship_to_firstname, ship_to_lastname, ship_to_company, ship_to_street, ship_to_city, ship_to_country_id, ship_to_postcode, ship_to_telephone, increment_id) VALUES(".$result_str_order.")"; 


where $result_str_order = '100','21-Mar-2011','Sam','Right','sam.right@sasmple.com','Flight','Samy',
'RTR','SR INC','222,M.G.Bank's-Pipeline/Rd','Newyork','US','411230','999856230','20000507'

Now, in case of ship_to_street, I need to insert 222,M.G.Bank's-Pipeline/Rd but it contains special character like ,',-,/ etc.so how to insert special characters in oracle db?

  • 写回答

3条回答 默认 最新

  • dougu4027 2012-03-29 19:13
    关注

    The only character you need to escape is ' (because you're using single quotes as string delimiters). So that's:

    $query1 ="INSERT INTO sample(po_number , created_at , customer_firstname , customer_lastname , customer_email , 
    shipping_description , ship_to_firstname, ship_to_lastname, ship_to_company, ship_to_street, ship_to_city, ship_to_country_id, ship_to_postcode, ship_to_telephone, increment_id) VALUES(".$result_str_order.")"; 
    
    
    where $result_str_order = '100','21-Mar-2011','Sam','Right','sam.right@sasmple.com','Flight','Samy',
    'RTR','SR INC','222,M.G.Bank\'s-Pipeline/Rd','Newyork','US','411230','999856230','20000507'
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制