PHP post方法在本地工作!不能在服务器上工作


php post method working in localhost! not working in server

我的php文件Picture_gallery.php:

 <?php
    include('connect-db.php');
    $response = array("total_records" => "", "result_returned" => "");
    $data = array("error_code" => "", "error_message" => "");
    $order = "";
    $sql = "Select * from ju_picture_gallery";
    $total_row = "";
    $result = "";
    $image_gallery = "folder_name";
    //$start_index =$_POST['start_index'];
    //$per_page =$_POST['per_page'];
    
    $folder_name = $_POST['folder_name'];
    $start_index = htmlspecialchars($_POST['start_index']);
    $per_page =htmlspecialchars($_POST['per_page']);
    
    //$folder_name = htmlspecialchars($_POST['folder_name']);
    
    
    //$start_index = print_r($_POST['start_index']);
    //$per_page =print_r($_POST['per_page']);
    //$folder_name = print_r($_POST['folder_name']);
    
    if ($folder_name == "$folder_name") 
    {
        $sql = "select pg_image_url from ju_picture_gallery where folder_name ='$folder_name' LIMIT $start_index,$per_page";
        $total_row = "SELECT *  FROM ju_picture_gallery where folder_name ='$folder_name' ";
        $image_gallery = "image_gallery";
        json_encode($result);
        
        
    }
    
    
    $result = mysqli_query($con, $sql);
    $count = mysqli_num_rows($result);
    $total=mysqli_num_rows(mysqli_query($con,$total_row));
    $response["result_returned"]=(string)$count;
    $response["total_records"]=(string)$total;
    $response["folder_name"] = (string)$folder_name;
    if ($result) {
        while ($r = mysqli_fetch_assoc($result)) {
            $json[] = $r;
    
        }
        $row_count = mysqli_num_rows($result);
        if ($row_count > 0) {
            print json_encode(array_merge($data, array('pagination_info' => $response), array($image_gallery => $json)));
    
        } else {
            $data["error_code"] = "1012";
            $data["error_message"] = "No Content!";
            print json_encode(array_merge($data, array('pagination_info' => $response)));
    
        }
    
    }
    mysqli_close($con);
    ?>

如果在本地主机上运行这个文件,它会为上面所有的post值询问3个值。如果我在web软管中运行,它不会询问post值…显示一个空屏幕。这是我的网站托管链接:

  • o/p为空屏
  • 在这个链接上我得到一个错误

警告:mysqli_num_rows()期望参数1为mysqli_result,布尔值在C:'Inetpub'vhosts'certifytechnologies.com'mobileapp'jumeirah'picture_gallery.php第36行

PHP警告:mysqli_num_rows()期望参数1为mysqli_result,布尔值在C:'Inetpub'vhosts'certifytechnologies.com'mobileapp'jumeirah'picture_gallery.php第36行

我认为你需要在你的代码中改变一些行

 $result = mysqli_query($con, $total_row);
$count = mysqli_num_rows($result);

  $total=mysqli_num_rows(mysqli_query($con,$count));
$response["result_returned"]=(string)$count;
$response["total_records"]=(string)$total;
$response["folder_name"] = (string)$folder_name;
if ($result) {
 while ($r = mysqli_fetch_assoc($result)) {
        $json[] = $r;
    }