首页 > 解决方案 > PHP 处理上传函数

问题描述

我正在构建一个表单,它将表单内容上传到数据库(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>

标签: phpmysqlforms

解决方案


推荐阅读