我被困了一段时间,我试着在html表中显示执行sql查询的变量的结果,这是我的代码;
$REQUT = Doctrine_Query::create()
->select('DISTINCT r.prod , r.di, COUNT(*) as Result')
->from('tabl r')
->groupBy('r.di')
->orderBy('Result ASC') ;
$REQUT->fetchArray();
PS:我在symfony工作,我希望有一个像mysql的视图
答案 0 :(得分:1)
您需要遍历结果集。我不知道这个特定的API,但假设它与其他API类似:
$REQUT = // all that query stuff
while($ROW = $REQUT->fetchArray()) {
// do something
var_dump($ROW);
}
答案 1 :(得分:0)
您可以尝试将其显示为html表格...
$REQUT = Doctrine_Query::create()
->select('DISTINCT r.prod , r.di, COUNT(*) as Result')
->from('tabl r')
->groupBy('r.di')
->orderBy('Result ASC') ;
echo "<table>";
while($ROW = $REQUT->fetchArray())
{
echo "<tr><td>".$ROW["prod"]."<td>";
echo "<td>".$ROW["di"]."<td></tr>";
}
echo "</table>";