如何使用真正的转义字符串插入日期? [英] How to INSERT into the date using real escape string?

查看:89
本文介绍了如何使用真正的转义字符串插入日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我需要使用真正的逃生字符串插入日期/时间



我尝试过:



Hi i need to Insert into the date/time using real escape string

What I have tried:

$query = "insert into tblcomments

set

commentedby = '".$con->real_escape_string($_POST['commentedby'])."',

comments = '".$con->real_escape_string($_POST['comments'])."'";


$trn_date = date("Y-m-d H:i:s");

if( $con->query($query) ) {



}else{



echo "<center>Database Error: Unable to create record.</center>";

}


$con->close();

}

?>

推荐答案

query =insert into tblcomments

set

commentedby ='。
query = "insert into tblcomments set commentedby = '".


con> real_escape_string(
con->real_escape_string(


_POST ['commentedby'])。',

comments ='。
_POST['commentedby'])."', comments = '".


这篇关于如何使用真正的转义字符串插入日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆