这是我用于查询的 php 脚本:
$query="SELECT f.EVENT,
f.LOCATION,
f.DOE,
f.CATEGORY,
f.LOGLOC,
f.LOGDOE,
f.LOGCAT,
((( f.NUMOFTIMESLOC * ( Log(f.LOGLOC) ) ) +
( f.NUMOFTIMESDOE * ( Log(f.LOGDOE) ) ) + (
f.NUMOFTIMESCAT * (Log(f.LOGCAT))))) AS FINALRANK
FROM (SELECT E.EVENT,
ED.LOCATION,
ED.DOE,
ED.CATEGORY,
( ( ED.NUMOFDATASET / ED.NUMOFTIMESLOC ) * 100 ) AS LOGLOC,
( ( ED.NUMOFDATASET / ED.NUMOFTIMESDOE ) * 100 ) AS LOGDOE,
( ( ED.NUMOFDATASET / ED.NUMOFTIMESCAT ) * 100 ) AS LOGCAT,
ED.NUMOFTIMESLOC,
ED.NUMOFTIMESDOE,
ED.NUMOFTIMESCAT
FROM EVENT E,
EVENTDETAIL ED
WHERE E.EVENTID = ED.EVENTID
AND ED.LOCATION = 'Liverpool'
AND ED.CATEGORY = 'Concerts') f ORDER BY FINALRANK";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
if(!$num){
echo ("No Results");
}
else{
while ($i < $num) {
$eventid=mysql_result($result,$i,"eventid");
echo $eventid;
echo"<br>";
$i++;
}
}
当此查询在命令控制器中运行时,它工作正常并为查询打印 2 个结果,但与 PHP 一起使用时,它只返回“无结果”。请帮忙!