PHP mysql插入不工作,没有错误 [英] Php mysql insert not working and no error

查看:92
本文介绍了PHP mysql插入不工作,没有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?php 
if(isset($ _ POST ['submit'])){
$ post_name = mysqli_real_escape_string($ _ POST ['post_name']);
$ post_image = mysqli_real_escape_string($ _ FILES ['image'] ['name']);
$ post_image_temp = mysqli_real_escape_string($ _ FILES ['image'] ['tmp_name']);
$ post_desc = mysqli_real_escape_string($ _ POST ['post_desc']);

move_uploaded_file($ post_image_temp,/ images / $ post_image);

$ query =INSERT INTO post(post_name,post_image,post_desc);
$ query。=VALUES('。$ post_name。','。$ post_image。','。$ post_desc。');

$ result = mysqli_query($ connection,$ query);
if(!$ result){
die(QUERY FAILED。。mysqli_error());
}

}
?>





我有什么试过:



 php mysql insert not working and no error 

解决方案

_POST ['submit'])){


post_name = mysqli_real_escape_string(


_POST ['post_name' ]);

<?php
if(isset($_POST['submit'])){
    $post_name=mysqli_real_escape_string($_POST['post_name']);
     $post_image=mysqli_real_escape_string($_FILES['image']['name']);
    $post_image_temp=mysqli_real_escape_string($_FILES['image']['tmp_name']);
    $post_desc=mysqli_real_escape_string($_POST['post_desc']);
    
          move_uploaded_file($post_image_temp,"/images/$post_image");
    
    $query ="INSERT INTO post(post_name,post_image,post_desc) ";
    $query .= "VALUES('".$post_name."','".$post_image."','".$post_desc."')";
    
    $result=mysqli_query($connection,$query);
    if(!$result){
           die("QUERY FAILED.".mysqli_error());
       }
   
}
?>



What I have tried:

php mysql insert not working and no error

解决方案

_POST['submit'])){


post_name=mysqli_real_escape_string(


_POST['post_name']);


这篇关于PHP mysql插入不工作,没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆