有誰知道在此查詢的問題是什麼,每次我往裏面outouts腳本的形式「問題!」查詢始終輸出Probmlem
if(isset($_POST['submit'])){
//getting the text data from the fields
$title = $_POST['title'];
$cat= $_POST['cat'];
$desc = $_POST['desc'];
$qty = $_POST['qty'];
$price = $_POST['price'];
$status = $_POST['status'];
//getting the image from the field
$image = $_FILES['image']['name'];
$image_tmp = $_FILES['image']['tmp_name'];
move_uploaded_file($image_tmp,"images/drinks/$image");
$insert_product = "insert into drinks (title,cat,image,desc,qty,price,status) values ('$title','$cat','$image','$desc','$qty','$price','$status')";
$insert_pro = mysqli_query($con, $insert_product);
if($insert_pro){
echo "<script>alert('Drink Has been inserted!')</script>";
echo "<script>window.open('index.php?viewdrink','_self')</script>";
}
else{
echo "<script>alert('Problem!')</script>";
}
}
如何改進此代碼使其工作。
你知道如何檢查真正的錯誤?你有一個,一個重要的。 –
我不知道,var_dump() –
什麼是'$ con'? –