gpt4 book ai didi

php - SQL 语法错误 :Mysqli prepare with NOW()

转载 作者:太空宇宙 更新时间:2023-11-03 11:49:10 24 4
gpt4 key购买 nike

function newpage($user_id,$page_title,$page_name,$page_content){
if(!$stmt=$this->_conn->prepare("INSERT INTO pages(user_id,heading,name,content,created)values(?,?,?,?,NOW())")){
echo $this->_conn->error;
}
$stmt->bind_param('isss',$user_id,$page_title,$page_name,$page_content);

if(!$stmt->execute()){
return false;
}else{
return true;
}
}

查询中的任何问题,使用 mysqli 准备语句,查询包含当前时间的 NOW()..在 mysql db 'created' 中更改为“sting(20)”

错误是

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Fatal error: Call to a member function bind_param() on boolean in C:\program data2\xampp\htdocs\engine\admin\cms.class.php on line 15

**

Solved...

**

最佳答案

我认为 ')' 不见了

"INSERT INTO pages(user_id,heading,name,content,created)values(?,?,?,?,NOW())"

关于php - SQL 语法错误 :Mysqli prepare with NOW(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36614668/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com