php – 将MySQL查询的结果动态显示到HTML页面中

我使用YII框架,我想将MySQL查询的结果放在index.PHP的表中.

MySQL查询已经很好了:

SELECT categories.name,
    systemes.name,
    systemes.etat_de_base,
    maintenances.name,
    maintenances.date,
    maintenances.duree 
FROM systemes_maintenances 
LEFT JOIN systemes 
ON systemes_maintenances.id_systemes = systemes.id_systemes 
LEFT JOIN categories 
ON systemes.id_categories = categories.id_categories 
LEFT JOIN maintenances 
ON systemes_maintenances.id_maintenances = maintenances.id_maintenances;

我的PHP页面目前看起来像这样:

<?PHP
/* @var $this SiteController */

$this->pageTitle=Yii::app()->name;
?>

<!--<h1>Welcome to <i><?PHP echo CHtml::encode(Yii::app()->name); ?></i></h1>

<p>Congratulations! You have successfully created your Yii application.</p>

<p>You may change the content of this page by modifying the following two files:</p>
<ul>
    <li>View file: <code><?PHP echo __FILE__; ?></code></li>
    <li>Layout file: <code><?PHP echo $this->getLayoutFile('main'); ?></code></li>
</ul>

<p>For more details on how to further develop this application, please read
the <a href="http://www.yiiframework.com/doc/">documentation</a>.
Feel free to ask in the <a href="http://www.yiiframework.com/forum/">forum</a>,
should you have any questions.</p>-->

<table>
    <caption>&Eacute;tat des systèmes</caption>
    <tr>
    <th>Cat&eacute;gorie</th>
    <th>Nom</th>
    <th>&Eacute;tat actuel</th>
    <th>Maintenance prévue</th>
    <th>Début de l'incident</th>
    </tr>
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>



</table>

我想在空的< td>中显示结果. < / td>.

没有jQuery,有谁知道如何做到这一点?

解决方法:

由于您使用的是Yii框架,因此可以使用CGridView组件.这提供了一组很好的功能,例如排序,分页和过滤.
检查以下链接获取示例用法.
http://www.yiiplayground.com/index.php?r=UiModule/dataview/gridView

相关文章

1、将Yii2.0advanced版中应用主体frontend或backend应用复制...
Yii2restfulAPI文档一、配置模块:1.Config/main.php:  2...
Yii在framework/i18n/data/%lang%.php文件中有很多翻译.这...
在Yii2中,官方的页面多语言解决方案有两个:方案1,使用Yii...
Yii2.0对数据库查询的一些简单的操作1234567891011121314151...
数据查询User::find()->all();此方法返回所有数据;User:...