1
<?php 

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: X-Requested-With');
header('Access-Control-Allow-Methods:GET');

    if($_SERVER['REQUEST_METHOD']=='GET')
    {

        $username  = $_GET['username'];
        $status  = $_GET['status'];

        require_once('dbConnect.php');

        if(!empty($username))
        {

            if(empty($status))
            {

        $sql = "SELECT * FROM ticketdetails WHERE (Status != 'Close' or Status != 'H/W_prob')  
        and cancel !='ok' and  person='".$username."'";
            }            
            else
            {
                    $sql = "SELECT * FROM ticketdetails WHERE   cancel !='ok' 
                    and status= '".$status."' and person='".$username."'";
            }
        $r = mysqli_query($con,$sql);

        $result = array();


        while($res = mysqli_fetch_assoc($r))
        {
            $a[]=$res;

            $result['data']=$a;

        }

        }
        else{
    $result['status'] = "false";
            }

        echo json_encode($result);

        mysqli_close($con);


    } 

when I check this api I got empty result in output , I have Two server one live and test this api work properly on test server and also locally on wamp but when I upload this script into live I show empty result anything wrong or what i cant understand.....

1 Answer 1

1

The most obvious thing to do is check that you have synced the databases so that there are indeed results to be returned on the "live" server... Could there be an empty result because the database/tables aren't populated as they should be?

Sign up to request clarification or add additional context in comments.

2 Comments

database not sync and table value record more than 50 thousand @Alister Cameron
$result = array(); //echo $result; foreach ($r as $row) { $result['data'] = array($row); }} when use foreach than shows only one row result show not all rows

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.