Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.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 mysql_fetch_row()期望参数1是给定的资源布尔值_Php_Mysql - Fatal编程技术网

Php mysql_fetch_row()期望参数1是给定的资源布尔值

Php mysql_fetch_row()期望参数1是给定的资源布尔值,php,mysql,Php,Mysql,我得到的php错误如下:我试着查看发布的任何其他答案是否符合我的问题,但它们不符合我的问题。这里就是。 这段php代码在我的上一个主机服务器上运行良好,但现在我遇到了问题 mysql_fetch_row() expects parameter 1 to be resource, boolean given in showcart.php on line 17 $row = mysql_fetch_row($result); and mysql_fetch_row() expect

我得到的php错误如下:我试着查看发布的任何其他答案是否符合我的问题,但它们不符合我的问题。这里就是。
这段php代码在我的上一个主机服务器上运行良好,但现在我遇到了问题

mysql_fetch_row() expects parameter 1 to be resource, boolean given in showcart.php on line 17

$row = mysql_fetch_row($result);    

and 

mysql_fetch_row() expects parameter 1 to be resource, boolean given in inc_showcart.php on line 2

while($row = mysql_fetch_array($result)) 
result.php3代码

<?
//error message (not found message)
$XX = "No Record Found";
mysql_select_db("india3arts") or die( "Unable to select database");
?>
<?
//error message (not found message)
$XX = "No Record Found";
$result1 = msql_query ("select * FROM items where ".$metode." like '%".$search."%' limit 0,     1095 ");
while ($row = mysql_fetch_array($result1))
{
$variable1=$row["itemDesc"];
$variable2=$row["itemName"];
$variable3=$row["itemPrice"];
print ("this is for $row["itemDesc"];, and this print the variable2 end so on...");

}
//below this is the function for no record!!
if (!$variable1)
{
print ("$XX");
}
//end
?>


在将$result1传递给mysql\u fetch\u数组之前,请检查它。您将发现它是false,因为查询失败

添加用于检查查询结果的代码。改变

$result1 = msql_query ("select * FROM items where ".$metode." like '%".$search."%' limit 0,     1095 ");
while ($row = mysql_fetch_array($result1))

mysql\u query\u行(resource$result[,int$result\u type=mysql\u BOTH])函数的第一个参数将是资源类型

当我们使用
mysql时,query()
将在成功时返回resource,或在select语句出错时返回false

从您的错误消息来看,
mysql\u query()
似乎是错误的

更多关于。因此,您可以先检查您的
mysql\u query()
是否成功

$result1 = msql_query ("select * FROM items where ".$metode." like '%".$search."%' limit 0,     1095 ");
if($result1) {
while ($row = mysql_fetch_array($result1))