我是PHP的新手,所以请耐心等待。我正在研究工作中的数据库项目,我在那里实习。 考虑到已从数据库中提取数据,我试图显示一个表。我有3张桌子
表vege_plant
表vege_location
表vege_data
我的PHP代码如下所示:
<?php
$sql = mysql_query('SELECT vege_data.*, vege_location.*, vege_plants.*
FROM vege_data
JOIN vege_location ON vege_location.uuid =vege_data.vege_location_uuid
JOIN vege_plants ON vege_plants.uuid = vege_data.vege_plants_uuid;);
echo '<table class = "table table-hover">
<thead>
<tr>
<th>Location</th>
<th>Transect Number</th>
<th>Quadrat Number</th>
<th>Plant Name</th>
<th>Alive</th>
<th>Dead</th>
<th>Action</th>
</tr>
</thead>
<tbody>';
$count = 1;
while ($row = mysql_fetch_assoc($result)) {
echo '<tr>';
echo '<td contenteditable="true">';
echo '<td>';
echo $row['location'];
echo '</td>';
echo '</td>';
echo '<td contenteditable="true">';
echo $row['transect_num'];
echo '</td>';
echo '<td contenteditable="true">';
echo $row['quadrant_num'];
echo '</td>';
echo '<td contenteditable="true">';
echo $row['name'];
echo '</td>';
echo '<td contenteditable="true">';
echo $row['alive'];
echo '</td>';
echo '<td>';
echo $row['dead'];
echo '</td>';
echo '</tr>';
}
但是,它无法显示,也没有提示任何错误。我不知道自己哪里出错了。
答案 0 :(得分:0)
尝试这在第1行qoute缺失
时出现语法错误 $sql = mysql_query('SELECT vege_data.*, vege_location.*, vege_plants.*
FROM vege_data
JOIN vege_location ON vege_location.uuid =vege_data.vege_location_uuid
JOIN vege_plants ON vege_plants.uuid = vege_data.vege_plants_uuid;');
while ($row = mysql_fetch_array($result))