ibase查询 - 不显示数据

时间:2017-09-19 11:57:12

标签: php firebird

我有这个查询从数据库(firebird DB)获取数据并将其打印到表格中......

    <?php

   $dbh = ibase_pconnect("pathtoDB", "SYSDBA", "masterkey") or die('die message');
    $q = ibase_query($dbh, "select sc.code as kod, sc.name as nazov, ssc.Quantity as mnozstvo, ssc.LowLimitQuantity as limit
from storecards sc
join storesubcards ssc on ssc.StoreCard_ID = sc.ID
where sc. X_Visible = 'A' and ssc.Store_ID = '2000000101' ");

表....

while ($r = ibase_fetch_row($q)) {
        $code = $r->kod;
        $name = $r->nazov;
        $mnozstvo = $r->mnozstvo;
        $limit = $r->limit;


        echo "<tr>";
echo "<td>" . $kod . "</td>";
echo "<td>" . $nazov . "</td>";
echo "<td>" . $mnozstvo . "</td>";
echo "<td>" . $limit . "</td>";

echo "</tr>";
    }   

echo "</table>";     

?>

但我的结果是来自表的空数据,它只显示行数

1 个答案:

答案 0 :(得分:0)

您混淆了变量名称。

$code = $r->KOD;
$name = $r->NAZOV;
$mnozstvo = $r->MNOZSTVO;
$limit = $r->LIMIT;

echo "<tr>";
echo "<td>" . $code. "</td>";
echo "<td>" . $name. "</td>";
echo "<td>" . $mnozstvo . "</td>";
echo "<td>" . $limit . "</td>";
echo "</tr>";