我有一个查询数据库并计算其中行数的函数。
if($action=='shipping_list')
{
$row;
$shipping=shipping_list();
$numrow=$r[0];
$row=mysql_fetch_row($paging);
include('shipping_list.php');
}
function shipping_list()
{
global $MEMS;
global $row;
$query = "SELECT * FROM Inventory
WHERE Yield >=330 AND
(Q = 'Pass' OR Q = 'No Q') AND
shipdate = ' '
ORDER BY Wafer ASC, RC ASC";
$shipping = $MEMS -> query($query);
$query = "SELECT COUNT(*) Inventory
WHERE Yield >=330 AND
(Q = 'Pass' OR Q = 'No Q') AND
shipdate = ' '";
$paging = $MEMS -> query($query);
return $shipping;
}
基本上,它调用函数,该函数有一个 SQL 命令来计算返回的查询数。然后代码使用 MySQL fetch row 获取行。
但是,$row
继续返回NULL
,这里有人知道我做错了什么吗?