【发布时间】:2018-05-05 13:01:23
【问题描述】:
我正在从 SQL 数据库中的多个表中搜索数据并显示在 PHP 网页中。
但是,我有一个错误:
警告:mysql_fetch_array() 期望参数 1 是资源,布尔值在 C:\xampp\htdocs\projets\simple_veto\rdv_liste.php 第 71 行给出
这里是查询:
<table class="table table-sm table-dark">
<tr>
<th>Client</th>
<th>Médecin</th>
<th>Animal</th>
<th>Cabinet</th>
<th>Date</th>
<th>Heure</th>
</tr>
<!-- Script de liste -->
<?php
//On recupere les informations
$req = mysql_query('SELECT rdv.client, rdv.medecin, rdv.animal, rdv.cabinet, client.nom, medecin.nom, animal.nom, cabinet.nom, date_rdv, time FROM client, medecin, animal, cabinet WHERE rdv.client=client.id_cli AND rdv.medecin=medecin.id_med AND rdv.animal=animal.id_ani AND rdv.cabinet=cabinet.id_cab');
while($dnn = mysql_fetch_array($req))
{
?>
<tr>
<td class="left"><?php echo htmlentities($dnn['client'], ENT_QUOTES, 'UTF-8'); ?></td>
<td class="left"><?php echo htmlentities($dnn['medecin'], ENT_QUOTES, 'UTF-8'); ?></td>
<td class="left"><?php echo htmlentities($dnn['animal'], ENT_QUOTES, 'UTF-8'); ?></td>
<td class="left"><?php echo htmlentities($dnn['cabinet'], ENT_QUOTES, 'UTF-8'); ?></td>
<td class="left"><?php echo htmlentities($dnn['date_rdv'], ENT_QUOTES, 'UTF-8'); ?></td>
<td class="left"><?php echo htmlentities($dnn['time'], ENT_QUOTES, 'UTF-8'); ?></td>
</tr>
<?php
}
有关信息,
我的数据库如下:
表 rdv - 包含以下行:id_rdv、client、medecin、animal、cabinet、date_rdv、time
在此表中:
- client 是 -> table client 的外键
- medecin 是 -> 表 medecin 的外键
- animal 是 -> table animal 的外键
- cabinet 是 -> table cabinet 的外键
非常感谢您的帮助,
【问题讨论】:
标签: php sql search html-table multiple-tables