嗨,我的PHP更新查询不会返回任何值。它应该返回我success
或failed
但它不是你们能解决这个问题吗?PHP Mysql更新查询不会返回任何内容
无视证券在这里我只是使用这个查询为我的android应用程序。
这是我的代码。
<?php
include_once("connection.php");
if(isset($_POST['txtCar_No']) && isset($_POST['txtCarModel']) &&
isset($_POST['txtCarType']) && isset($_POST['txtCapacity']) &&
isset($_POST['image']) && isset($_POST['txtFuelType']) &&
isset($_POST['txtPlateNumber']) && isset($_POST['txtcarPrice']))
{
$now = DateTime::createFromFormat('U.u', microtime(true));
$id = $now->format('YmdHis');
$upload_folder = "upload";
$path = "$upload_folder/$id.jpeg";
$fullpath = "http://carkila.esy.es/$path";
$image = $_POST['image'];
$Car_No = $_POST['txtCar_No'];
$Car_Model = $_POST['txtCarModel'];
$Car_Type = $_POST['txtCarType'];
$Capacity = $_POST['txtCapacity'];
$Fuel_Type = $_POST['txtFuelType'];
$PlateNumber = $_POST['txtPlateNumber'];
$carPrice = $_POST['carPrice'];
$query = "UPDATE tbl_cars SET Car_Model='$Car_Model', Car_Type='$Car_Type', Capacity='$Capacity', fuelType='$Fuel_Type' ,carPlatenuNumber='$PlateNumber', image='$fullpath' , carPrice = '$carPrice' WHERE Car_No=$Car_No";
$result = mysqli_query($conn,$query);
echo $Car_No;
if($result > 0){
echo "success";
exit();
} else {
echo "failed";
exit();
}
}
?>
请检查[this](http://stackoverflow.com/questions/6131304/how-to-determine-if-a-mysql-update-query-succeeded-when-the-data-passed-in-the -q)问题。由于其相关并在 – Taacoo
之前处理,您可以使用mysqli_error函数并在查询中检查错误。它显示查询 – bhawani
中的任何错误使用mysqli_num_rows($ result) – phpdroid