doudi8525 2017-04-07 19:13
浏览 448

如何将文本中的逗号保存到MySQL数据库中

I have a form where users can save text to a mysql database. I'm using a prepared statement to insert the data but I can't understand why I am unable to insert any text that has a comma. When I retrieve the $detail string it echoe's out but ends as soon as it hits a comma. What am I missing? Thanks.

Example: I want to insert this statement, ok.

Prints out: I want to insert this statement

My code (simplified)

$detail=htmlentities($_POST["detail"], ENT_QUOTES);
$id=$_POST["id"];

$stmt = $db_conx->prepare('UPDATE tbl_uploads SET detail=? WHERE id=?');
$stmt->bind_param('ss',$detail,$id);
$stmt->execute();

if ($stmt->execute()) { //true
    echo'success';
}else{
    echo "error";
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
    • ¥15 求daily translation(DT)偏差订正方法的代码
    • ¥15 js调用html页面需要隐藏某个按钮
    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler