我有一个正在构建的表单,该表单将表单内容上载到数据库(MySQL)中,并有一个单独的页面来显示数据库的内容。到目前为止,一切都很好。我只需要用户能够将图像文件和表单一起上载,并且我需要图像本身以及我可能要添加的其他几个字段,以将其与数据库内容一起显示在页面上。我已经创建了字段和图像上载器,但是当我运行程序时,它不会显示添加的字段和照片。从那以后,我已经为数据库中的新字段创建了新列。
如何通过修改现有代码来完成此任务?
我编写了这些代码以从数据库中提取数据。
<?php
$query = mysqli_query($connection,"select * from students where student_id = '$get_id'")or die(mysqli_error());
$row = mysqli_fetch_array($query);
$cl = $row['class'];
?>
<div class="alert alert-success">STUDENT DETAILS</div>
<div class="span6">
Image: <strong><?php echo $row['image']; ?></strong><hr>
Name: <strong><?php echo $row['firstname']." ".$row['middlename']." ".$row['lastname']; ?></strong><hr>
Gender: <strong><?php echo $row['gender']; ?></strong><hr>
Date Of Birth: <strong><?php echo $row['dob']; ?></strong><hr>
Address: <strong><?php echo $row['address']; ?></strong><hr>
Payment Status: <strong><?php echo $row['status']; ?></strong><hr>
Prefix: <strong><?php echo $row['prefix']; ?></strong><hr>
suffix: <strong><?php echo $row['suffix']; ?></strong><hr>
Email Address: <strong><?php echo $row['eaddress']; ?></strong><hr>
Phone Number: <strong><?php echo $row['pnumber']; ?></strong><hr>
School Year: <strong><?php echo $row['syear']; ?></strong><hr>
Subjects Enrolled: <strong><?php echo $row['senrolled']; ?></strong><hr>
Number of Units: <strong><?php echo $row['Nofunits']; ?></strong><hr>
</div>
<div class="span5">
Class: <strong><?php echo $row['class']; ?></strong><hr>
<?php
$query2 = mysqli_query($connection,"select * from class where class_name = '$cl'")or die(mysqli_error());
while ($row1=mysqli_fetch_array($query2)){
$category = $row1['category'];
$fee = $row1['fee'];
}?>
Class Category: <strong><?php echo $category; ?></strong><hr>
Class Fee: <strong><?php echo $fee; ?></strong><hr>
Transport: <strong><?php echo $row['transport']; ?></strong><hr>
Route: <strong><?php echo $row['route']; ?></strong><hr>
</div>
</div>