php - 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>
解决方案
推荐阅读
- swift - DateFormatter 的奇怪行为:时间不一致
- python-3.x - 显示需要 macOS 11 或更高版本!zsh: abort as a run a simple code with module Tkinter
- perl - 在 Perl 中格式化 Outlook 电子邮件
- powershell - 使用 PowerShell 更改文本文件中的数值
- javascript - XSJS 从变量中的存储过程获取结果
- node.js - 使用 DynamoDB Docker 容器的 Github 操作
- excel - VBA:仅向 excel 组合框添加唯一值,该组合框通过在工作簿打开时循环访问源工作表范围来填充
- java - Flurry 测试推送通知来了,但是campain 通知不来
- coldfusion - CFWheels 错误:元素 RETURNVALUE 在 LOC 中未定义
- javascript - 从标题下的降价列表中获取每个项目