$table
我的<?php print_r($table); ?>
<table class="table">
<?php foreach ($table as $key => $q): ?>
<?php foreach ($secteur as $key => $s): ?>
<tr>
<th><?php echo $key; ?></th>
<td><?php echo $q['nbr']; ?></td>
<td><?php echo $q['total']; ?></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
</body>
</html>
返回一行而非整表(最后一行)。在php文件中它很好:
<script>
var app = angular.module('overridden', []);
</script>
<script>
var overriddenApp = angular.module('overridden', []);
</script>
答案 0 :(得分:1)
每次循环都会覆盖$table
。尝试一个数组:
$table[] = $result->fetchAll();
其他问题:
<?php foreach ($table as $key => $q): ?>
<?php foreach ($secteur as $key => $s): ?>
$key
。$secteur
来自哪里?它没有定义。也许你的意思是$q
?