php post方法在localhost中工作!不在服务器上工作

时间:2014-07-24 06:50:50

标签: php

我的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);
    ?>

这里如果在localhost中运行这个文件,它会询问所有上述帖子值的3个值。如果我在网络软件中运行,它不会询问帖子值...显示空的信息。 这是我的虚拟主机链接:

  

警告:mysqli_num_rows()要求参数1为mysqli_result,布尔值在第36行的C:\ Inetpub \ vhosts \ certifytechnologies.com \ mobileapp \ jumeirah \ picture_gallery.php中给出

     

PHP警告:mysqli_num_rows()要求参数1为mysqli_result,布尔值在第36行的C:\ Inetpub \ vhosts \ certifytechnologies.com \ mobileapp \ jumeirah \ picture_gallery.php中给出

1 个答案:

答案 0 :(得分:0)

我认为您需要将代码中的某些行更改为

 $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;

    }