douxianliu6756 2016-08-08 12:14
浏览 524

插入时pgsql字符串转义

I am new with PostgreSQL, I am trying to insert html code into my data base some text just cant be inserted such as single quotes for an example. I am looking for a code that would help me "trim" or allow allow my characters to be inserted. I have tried the following code it didnt work.

$title= $_POST['title'];
    $intro= $_POST['intro'];
    $content= $_POST['content'];
    $category= $_POST['category'];
    $sort_footer = 24;
 //insert code
    $stmt = $dbh->prepare("INSERT INTO content(title, intro, content, category, sort_footer ) 
    VALUES ( :title, :intro , :content , :category ,:sort_footer ) ");

    $stmt->bindParam(':title', $title);
    $stmt->bindParam(':intro', $intro);
    $stmt->bindParam(':content', $content);
    $stmt->bindParam(':category', $category);
    $stmt->bindParam(':sort_footer', $sort_footer);

    $stmt->execute();
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大