php while($row = mysql_fetch_row($result))出错了
$sql="SELECT*FROMmovementorderby$sortASC";$result=mysql_query($sql);while($row=mysql_...
$sql = "SELECT * FROM movement order by $sort ASC";
$result = mysql_query($sql);
while($row = mysql_fetch_row($result))
{
echo '<tr>';
echo ("<td>$row[0]</td>");
echo ("<td>$row[1]</td>");
echo ("<td>$row[2]</td>");
echo ("<td>$row[3]</td>");
echo ("<td>$row[4]</td>");
echo ("<td>$row[5]</td>");
echo ("<td>$row[6]</td>");
echo '</tr>';
}
完全没问题
但加了 where shop=$shop 出错了
$sql = "SELECT * FROM movement where shop=$shop order by $sort ASC";
$result = mysql_query($sql);
while($row = mysql_fetch_row($result)) ....... 这行出错了
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given
in /home/cybervalle/domains/cybervalley.com.hk/public_html/trans_report.php on line 53
请问何解
试了, 只要加 where 就出错了
where shop=shop1 没有order by $sort ASC 都出错
晕!!!!
解决了
方法 :
$sql = "SELECT * FROM movement where shop='$shop' order by $sort ASC"; 展开
$result = mysql_query($sql);
while($row = mysql_fetch_row($result))
{
echo '<tr>';
echo ("<td>$row[0]</td>");
echo ("<td>$row[1]</td>");
echo ("<td>$row[2]</td>");
echo ("<td>$row[3]</td>");
echo ("<td>$row[4]</td>");
echo ("<td>$row[5]</td>");
echo ("<td>$row[6]</td>");
echo '</tr>';
}
完全没问题
但加了 where shop=$shop 出错了
$sql = "SELECT * FROM movement where shop=$shop order by $sort ASC";
$result = mysql_query($sql);
while($row = mysql_fetch_row($result)) ....... 这行出错了
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given
in /home/cybervalle/domains/cybervalley.com.hk/public_html/trans_report.php on line 53
请问何解
试了, 只要加 where 就出错了
where shop=shop1 没有order by $sort ASC 都出错
晕!!!!
解决了
方法 :
$sql = "SELECT * FROM movement where shop='$shop' order by $sort ASC"; 展开
1个回答
2014-08-02
展开全部
从报错和你的语句上来看,应该是sql执行结果有问题,返回了一个bool值。
var_dump($sql);一下,然后拿到mysql中执行看结果。
var_dump($sql);一下,然后拿到mysql中执行看结果。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询