为什么我的ibase_query结果出现故障

时间:2018-10-22 22:32:27

标签: php firebird interbase

我有一个运行查询的PHP页面,并构建了一个表,该表按字母顺序列出了产生的名称。单独运行SQL会返回我期望的结果(Boronda通过Zuniga)。页面上产生的HTML基本上是按顺序排列的(Boronda通过Zuniga,然后Bravo通过Valenzuela)。

PHP

$sql = "SELECT
EMPLOYEE.EMPID, 
EMPLOYEE.LASTNAME,
EMPLOYEE.FIRSTNAME,
COALESCE(D0.AUDITS, 0) AS AUDITS
FROM EMPLOYEE 
LEFT OUTER JOIN 
(SELECT SUBJECT, COUNT(*) as AUDITS
 FROM AUDIT
 WHERE
 AUDIT.OBSDATE BETWEEN ? AND ?
 GROUP BY SUBJECT) D0
ON (D0.SUBJECT = EMPLOYEE.EMPID)
WHERE
  EMPLOYEE.ISACTIVE = 1 AND
   ((UPPER(EMPLOYEE.SF_POSITION) LIKE '%DRIVER%') OR
     (UPPER(EMPLOYEE.SF_POSITION) LIKE '%HYDROCRANE%'))
ORDER BY EMPLOYEE.LASTNAME, EMPLOYEE.FIRSTNAME";
$data = ibase_query($conn, $sql, $fromDateStr, $Today);
while
($row = ibase_fetch_assoc($data))
{
    $EmpName = $row['LASTNAME'].', '.$row['FIRSTNAME'];
    echo "<tr><td>",$EmpName,"</td>";
//other things...
}

0 个答案:

没有答案