Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 对非对象调用成员函数execute()_Php - Fatal编程技术网

Php 对非对象调用成员函数execute()

Php 对非对象调用成员函数execute(),php,Php,所以我的问题是标题中的错误,这是我的代码: jQuery(文档).ready(函数($){ $(“#食物搜索”).keyup(功能(事件){ var search_term=$(this.val(); $.ajax({ 类型:“POST”, 网址:“Mypage”, 数据:{'fsearch':搜索项}, 成功:功能(res){ $(“#食品搜索结果”).html(res); 控制台日志(res); }, 错误:函数(xhr、ajaxOptions、thrownError){ 警报(xhr.状

所以我的问题是标题中的错误,这是我的代码:

jQuery(文档).ready(函数($){
$(“#食物搜索”).keyup(功能(事件){
var search_term=$(this.val();
$.ajax({
类型:“POST”,
网址:“Mypage”,
数据:{'fsearch':搜索项},
成功:功能(res){
$(“#食品搜索结果”).html(res);
控制台日志(res);
},
错误:函数(xhr、ajaxOptions、thrownError){
警报(xhr.状态);
警报(xhr.responseText);
警报(thrownError);
}
});
});
});

ъаааааааа:


我通过添加一个var$fsearch并修复我的查询调用来修复它,因为“%”“%$“$fsearch.”“%”“我写的不正确”.$fsearch.”“%”,正如我所说,我添加了var$fsearch,如下所示:
$fsearch=$\u POST['fsearch'”;
我试过了,它能用吗

if($req) {
//code if it return true (if it is working)
}else{
//code if it return false(not working)
}
现在它是真的,这意味着查询是有效的,但给了我其他的

错误:mysqli_stmt::execute()需要0个参数,给定1个

好吧,我会问另外一个问题。
谢谢你的帮助!

我把它添加到我的代码中,上面写着“mysqli\u connect”找不到对不起,
$connect=new mysqli($hostname、$username、$password、$databaseName);
您必须以面向对象的方式创建连接。您好,欢迎来到Stackoverflow。请对您的答案添加一些解释,以便对其他用户更有价值。请参阅
if($req) {
//code if it return true (if it is working)
}else{
//code if it return false(not working)
}