当我将以下内容粘贴到phpmyadmin时,它会正确返回719条记录。
SET SQL_BIG_SELECTS=1;
select lc.townshipnumber, lc.sectionlegal, sum(fm.acres) FROM lc join fm on
lc.parcelnumber = fm.parcelnumber join fp on fm.type=fp.soiltype join fc on
(fp.soilgroup=fc.soilgroup and fp.soilclass=fc.soilclass) where townshipnumber
<=20 and sectionlegal<=36 and sectionlegal>=1 and fm.year = '2013' group by
townshipnumber, sectionlegal";
当我将其粘贴到php脚本中时,我使用$query = (*the select statement from above*)
然后使用$result = $mysqli->query($query) or die ("Errorr in query: $query. ".mysqli_error());
php脚本中的下一行显示找到的记录,但此特定查询的屏幕仍为空。
$records_found=mysqli_num_rows($result);
echo $records_found.' Records Found<br /><br />';
答案 0 :(得分:0)
你有结果作为一个对象,你还没有真正做过任何有用的事情。你可以将它变成一个数组并循环遍历它以获得结果。
<?php
// Save the query results in an array, which you can then loop through
var_dump(mysqli_fetch_array($result));