Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.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
mysql_fetch_assoc()参数1资源,对象在。。。第6行_Mysql_Json_Parameters_Resources_Oscommerce - Fatal编程技术网

mysql_fetch_assoc()参数1资源,对象在。。。第6行

mysql_fetch_assoc()参数1资源,对象在。。。第6行,mysql,json,parameters,resources,oscommerce,Mysql,Json,Parameters,Resources,Oscommerce,嗨,我已经找到了解决这个问题的方法,找到了几个答案,在对代码进行了多次编辑之后,我在这里直接询问没有成功 $return_arr = array(); $fetch = tep_db_query("select * from products, " . TABLE_PRODUCTS_DESCRIPTION . " WHERE products.products_status = '1' and products.products_id = " . TABLE_PRODUCTS_DESCRIPTI

嗨,我已经找到了解决这个问题的方法,找到了几个答案,在对代码进行了多次编辑之后,我在这里直接询问没有成功

$return_arr = array();
$fetch = tep_db_query("select * from products, " . TABLE_PRODUCTS_DESCRIPTION . " WHERE products.products_status = '1' and products.products_id = " . TABLE_PRODUCTS_DESCRIPTION . ".products_id and " . TABLE_PRODUCTS_DESCRIPTION . ".language_id = '" . (int)$languages_id . "' and " . TABLE_PRODUCTS_DESCRIPTION . ".products_name LIKE '%" . $_GET['term'] . "%'  LIMIT 0,10");
if($fetch === FALSE) {
    die(mysql_error());
}
while ($row = mysql_fetch_assoc($fetch)) 
{
   array_push($return_arr, $row['products_name']);
}  
print json_encode($return_arr);
这将返回:mysql\u fetch\u assoc()参数1资源,对象在。。。第6行

我明白了,只是似乎找不到问题

提前感谢

使用tep\u db\u fetch\u array()

字符串mysqli\u real\u escape\u字符串(mysqli$link,字符串$escapestr)

link-由mysqli_connect()或mysqli_init()返回的链接标识符 escapestr-要转义的字符串


您可以找到一个示例,第一个参数需要是mysqli_connect()返回的链接标识符。

幸运的是,由于您的建议,我有了另一个函数来实现“tep_db_fetch_array”这一技巧,我现在得到了一些结果,但这也是:mysqli_real_escape_string()希望参数1是mysqli,null给定此代码中存在错误..我认为您需要发布更多代码。这是调用PHP的脚本:$(function(){$(“#search”).autocomplete({source:“autocomplete.PHP”,minLength:3,select:function(event,ui){log(ui.item?”Selected:“+ui.item.value+”aka“+ui.item.id:“未选择任何内容,输入为“+this.value”)}); });
  $return_arr = array();
  $fetch = tep_db_query("select * from products, " . TABLE_PRODUCTS_DESCRIPTION . " WHERE products.products_status = '1' and products.products_id = " . TABLE_PRODUCTS_DESCRIPTION . ".products_id and " . TABLE_PRODUCTS_DESCRIPTION . ".language_id = '" . (int)$languages_id . "' and " . TABLE_PRODUCTS_DESCRIPTION . ".products_name LIKE '%" . $_GET['term'] . "%'  LIMIT 0,10");

  echo $fetch; die;
  if($fetch === FALSE) {
      die(mysql_error());
  }
  while ($row = tep_db_fetch_array($fetch))
  {
     array_push($return_arr, $row['products_name']);
  }  
  print json_encode($return_arr);