Php 图像未显示
我试图制作一个网站,在那里图像可以上传到数据库,并在网站上编辑,就像替换图像一样。每当我尝试替换网站中的图片时,它都会在数据库中被替换,但不会显示在网站中 这是我的PhP代码Php 图像未显示,php,mysql,sql,image,content-management-system,Php,Mysql,Sql,Image,Content Management System,我试图制作一个网站,在那里图像可以上传到数据库,并在网站上编辑,就像替换图像一样。每当我尝试替换网站中的图片时,它都会在数据库中被替换,但不会显示在网站中 这是我的PhP代码 if(isset($_POST['update_post'])){ $post_author = $_POST['post_author']; $post_title = $_POST['post_title']; // post_categ
if(isset($_POST['update_post'])){
$post_author = $_POST['post_author'];
$post_title = $_POST['post_title'];
// post_category from input
$post_category_id = $_POST['post_category'];
$post_status = $_POST['post_status'];
$post_image = $_FILES['post_image']['name'];
$post_image_temp = $_FILES['post_image']['name'];
$post_content = $_POST['post_content'];
$post_tags = $_POST['post_tags'];
move_uploaded_file($post_image_temp, "../images/$post_image");
if(empty($post_image)) {
$query = "SELECT * FROM posts WHERE post_id = $the_post_id ";
$select_image = mysqli_query($connection, $query);
while($row = mysqli_fetch_assoc($select_image)){
$post_image = $row['post_image'];
}
}
$query = "UPDATE posts SET ";
$query .= "post_title = '{$post_title}', ";
$query .= "post_category_id = '{$post_category_id}', ";
$query .= "post_date = now(), ";
$query .= "post_author = '{$post_author}', ";
$query .= "post_status = '{$post_status}', ";
$query .= "post_tags = '{$post_tags}', ";
$query .= "post_content = '{$post_content}', ";
$query .= "post_image = '{$post_image}' ";
$query .= "WHERE post_id = {$the_post_id} ";
$update_query = mysqli_query($connection, $query);
confirm($update_query);
}
这是我的数据库
这是我的网站
正如你在数据库中看到的,我在那里有图片,但在我的网站上,一些图片没有显示出来。我希望他们都来。请帮助大家好,我解决了自己的问题。错误代码$post\U image\U temp=$\U文件['post\U image']['name'];正确的代码$post\U image\U temp=$\U文件['post\U image']['tmp\U name']大家好,我解决了我自己的问题。错误的代码$post\U image\U temp=$\U文件['post\U image']['name'];正确代码$post\u image\u temp=$\u文件['post\u image']['tmp\u name']