Why do I not get a response from JSON post request unless the number of rows is limited?

238
June 29, 2017, at 05:16 AM

I am using a JSON post request to return rows from a mySQL database. My server-side language is php and unless I limit the results in sql to about 45 I don't get a response. No errors just no response. Any advice would be appreciated. The serverside code is as follows;

    <?php
  include('../config.php');
  $status = $_POST['status'];
  $itemGrp = $_POST['itemGrp'];
  $jobs_sql = "SELECT custName
                    ,SODocNum
                    ,itemName
                    ,cast(thickness as decimal (4,2)) as 'thickness'
                    ,case when ca_Description like 'Diary%' then ca_Description else 'Bespoke Diary' end as ca_Description
                    ,Quantity
                    ,version_id
                    ,case when T0.rqdByDate is null then '' else T0.rqdByDate end as rqdByDate
                    ,T0.despatchDate
                    ,case when T0.versionStatus = 010 then '' else 'w3-disabled' end as 'disableCmpltBtn'
                    ,case when T0.versionStatus = 010 then 'update_status_complete' else '' end as 'noclickCmpltBtn'
                    ,case when T0.versionStatus = 009 then '' else 'w3-disabled' end as 'disableChkBtn'
                    ,case when T0.versionStatus = 009 then 'update_status' else '' end as 'noclickChkBtn'
               FROM Versions T0 left outer join components_all T1 on T0.itemCode = T1.ca_versionCFG and T1.ca_itemGroup in (117,118)
               WHERE versionStatus in ('$status')
               and ItmsGrpCod in ('$itemGrp')
               order by thickness, T1.ca_itemCode asc, T0.despatchDate asc, SoDocNum
               LIMIT 45";
    $jobs_result = mysqli_query($db,$jobs_sql);
    $all_array = mysqli_fetch_all($jobs_result);
    echo json_encode($all_array);

?>

And this is what I have on the client side;

function get_jobs_to_bind(){
        console.log("Request data from server");
        $.post("/_api/jobs_to_bind_api.php",
        {
          status:'007',
          itemGrp:'121\',\'104\',\'106'          
        },
        function(data)          //on recieve of reply
      {
        console.log("Build table with data")
        $('#jobs_to_bind_table_body').empty();
        $.each(data, function (index, item) {
     var eachrow = "<tr>"
                 + "<td>" + item[0] + "</td>"
                 + "<td style='text-align:center'>" + item[1] + "</td>"
                 + "<td>" + item[2] + "</td>"
                 + "<td>" + item[3] + "</td>"
                 + "<td>" + item[4] + "</td>"
                 + "<td>" + item[7] + "</td>"
                 + "<td>" + item[8] + "</td>"
                 + "<td>" + item[5] + "</td>"
                 + "<td><button class='w3-btn w3-round w3-green w3-tiny' value = '" + item[6] + "' onclick='update_status(\"008\","+ item[6] +")'>Gathered</button></td>"
                 + "<td><button id='viewgathererinfo' class='w3-btn w3-round w3-green w3-tiny' value = '" + item[6] + "' onclick='getgathererinfo("+ item[6] +")'>View</button></td>"
                 + "</tr>";
     $('#jobs_to_bind_table_body').append(eachrow);
    });
    filterbind2();
    filterbind3();
  },'json');
}
Rent Charter Buses Company
READ ALSO
How to convert mySQL time to python time?

How to convert mySQL time to python time?

I'm trying to retrieve time variable from mySQL database using pythonBelow shows the python code I use to retrieve the time variable from mySQL database

384
Laravel query Builder with DATE mysql function

Laravel query Builder with DATE mysql function

Hi I have a query in my laravel project which should retrieve dates between rangesMy query is:

452