gpt4 book ai didi

mysql - SQL预备语句

转载 作者:行者123 更新时间:2023-11-29 05:54:23 25 4
gpt4 key购买 nike

我不断收到此错误:

Call to a member function bind_param() on boolean*



当我们尝试对不存在的表进行操作并且prepare语句返回false时,通常会出现该错误,但是我有一个结构化的表。
我准备的陈述是:
$query = "INSERT INTO `profiles`(name,email,handle,DOB,profilePic,gender,r_lat,r_lon,c_lat,"
. "c_lon,connections,recentActivities,savedItems,achievements,school,"
. "interestsB,interestsI,interestsE,work,coverPic,bio,fb_url,insta_url,link_url,wordpress_url,"
. "other_url,address,range,phone)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

PS:我愿意接受所有建议。
       $stmt=$mysqli->prepare($query);
$stmt->bind_param("ssssssddddsssssssssssssssssii",$name,$email,$handle,$DOB,$profilePic,$gender,$r_lat,$r_lon,$c_lat,$c_lon,
$connections,$recentActivities,$savedItems,$achievements,$school,$interestsB,
$interestsI,$interestsE,$work,$coverPic,$bio,$fb_url,$insta_url,$link_url,$wordpress_url,
$other_url,$address,$range,$phone);
$res = $stmt->execute();
return $res;

我正在发布屏幕截图:

打印错误返回:

1064 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 'range,phone)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)' at line 1

最佳答案

rangereserved word in MySQL。您可以通过用引号引起来将其转义:

`range`

关于mysql - SQL预备语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51097638/

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