doujing6436 2017-06-02 17:47
浏览 24

单击一次按钮时对多个相同的php脚本调用时出现php服务器端错误

I've got a php script which runs a sql query that's passed to it from some javascript code on an html page. The php script works fine until I call it more than once in quick succession (from the same button click), in this case the server only processes the first call to the php script, on the second call it gives an error 500 internal server error. Is it possible that, when the server receives the second call to the php script that the server has not completely finished processing the first call and thats why it is giving the error? If so is there a way to prevent this? I've included the php script below. Thanks for your time.

<?php

    $servername = "localhost";
    $username = "f3645807";
    $password = "MD5!a8aa";
    $dbname = "f3645807_wildlife";

    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);

    $qry = $_REQUEST["qry"];    

    $sql = $qry;

    $result = $conn->query($sql);
    $locArray = array();

    if ($result->num_rows > 0)
        /*if query pulls back at least 1 row run this bit*/
        {

            while($row=$result->fetch_assoc()) {
                // echo json_encode($row["Location_Name"]);
                $locArray[] = $row;
            }

            echo json_encode($locArray);            
        }   


?>  
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line