Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/278.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.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\u fetch\u array():在第48行的C:\wamp\www\mahesh\login\orderhistory.php中,提供的参数不是有效的mysql结果资源_Php_Mysql - Fatal编程技术网

mysql\u fetch\u array():在第48行的C:\wamp\www\mahesh\login\orderhistory.php中,提供的参数不是有效的mysql结果资源

mysql\u fetch\u array():在第48行的C:\wamp\www\mahesh\login\orderhistory.php中,提供的参数不是有效的mysql结果资源,php,mysql,Php,Mysql,可能重复: mysql\u fetch\u array():提供的参数不是有效的mysql结果资源 ` mysql\u select\u db(“test”,$con); $result=mysql_查询(“从订单中选择*); 回声“” while($row=mysql\u fetch\u数组($result)) { 回声“; 回显“$row['orderid']”; 回显“$row['odate']”; 回显“$row['pdtdetail']”; 回显“$行[“单价]”; 回显“$row[

可能重复:

mysql\u fetch\u array():提供的参数不是有效的mysql结果资源 `
mysql\u select\u db(“test”,$con);
$result=mysql_查询(“从订单中选择*);
回声“”
while($row=mysql\u fetch\u数组($result))
{
回声“;
回显“$row['orderid']”;
回显“$row['odate']”;
回显“$row['pdtdetail']”;
回显“$行[“单价]”;
回显“$row['quantity']”;
回显“$row['netprice']”;
回显“$row['status']”;
回声“;
}
回声“;
mysql_close($con);
?>`
当您编写SQL代码时,大家都知道这是您的责任

要确保查询正常运行…

在运行查询时,必须始终检查错误。
至少以以下方式运行所有查询:

$query  = "SELECT * FROM order"
$result = mysql_query($query) or trigger_error(mysql_error()." in ".$query); 

因此,您将始终被通知原因。

在mysql中,“order”是保留关键字,请使用ord或其他任何方式更改它…

您有什么问题?为什么不检查错误呢?嗨,新手,这很明显,提供的参数在那一行上不是有效的mysql结果。@bdonlan他对此一无所知?像99%的这个网站用户一样?@ajreal,是的,非常正确,因为你的问题在你的案例中有效的论点是你正在传递的查询,这意味着你的查询有一些问题issue@noobie-php我不知道你的意思…不仅仅限于SQL中的语法,可能是你没有正确建立数据库连接,数据库拒绝连接,数据库达到最大连接。。。诸如此类。你错过了查询,cmon基本资料,什么是$sql?并且NONOTIZED是拼写通知的…感谢您指出这一点。在这里你可以学习正确的方法。还要记住,在实时服务器上执行错误报告(0)是自杀行为。谢谢。我的代码正在运行。
SELECT * FROM order <-- this is a wrongful SQL
 SELECT * FROM `order`
$query  = "SELECT * FROM order"
$result = mysql_query($query) or trigger_error(mysql_error()." in ".$query);