PHPを使用してデータベースからデータを取得しようとしていますが、私のデータベースに約4つのフィールドがあります。あなたのテーブルを壊した理由。 このmycode enter image description hereデータベースから情報を照会する際に破損した行を修正する方法
public function departments_view($dept_id){
$query = $this->db->prepare("SELECT * FROM materials_tbl WHERE dept_id = $dept_id");
$query->execute();
if($query->rowCount()>0){
?>
<div class="table-responsive">
<?php
while($row=$query->fetch(PDO::FETCH_ASSOC)){
?>
<table class="table table-bordered table-hover">
<thead>
<tr>
<th>Material Code</th>
<th>Topic</th>
<th>Description</th>
<th>Path</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $row["material_code"];?></td>
<td><?php echo $row["topic"];?></td>
<td><?php echo $row["description"];?></td>
<td><?php echo $row["path"];?></td>
</tr>
</tbody>
</table>
<?php
}
?>
</div>
<?php
}else {
echo 'Nothing here.';
}
}
あなたは、 "私のテーブルが壊れます" とはどういう意味ですか? –
「ここに画像の説明を入力」をクリックすると、壊れた表が表示されます。私のデータは機密扱いですので、消去することにしました。ありがとう –