I am preparing an university project: online book selling shop environment. I have a PHP page that updates few values in a table while another PHP page that runs a SELECT query to display the values of table. The problem is after the first page updates the value, the second page doesn't display the changes instantly. There is a handful amount delay before the changes take effect in display. What could possibly be the reason? And how could the same be solved?
P.S. I am using these PHP pages to implement JSON Parsing for my Android Development(using volley)
First one:
<?php
include_once("connect_seller.php");
$table= $_GET['pin'];
$orderid= $_GET['oid'];
$sellerid= $_GET['id'];
$orderstatus= $_GET['ostat'];
$query1 = "SELECT COUNT(status) FROM " . $table . "WHERE order_id='$orderid' AND status=-1";
$result = mysqli_query($conn,$query1);
$res = mysqli_fetch_assoc($result);
if($res["COUNT(status)"] > 0)
{
    $query = "UPDATE " . $table . "SET order_status='$orderstatus', status='served' , served_by='$sellerid' WHERE order_id='$orderid'";
    if(mysqli_query($conn,$query))
    {
        echo '{"maal":[{';
        echo '"message":"success"}';
        echo ']}';
    }
    else
    {
        echo '{"maal":[{';
        echo '"message":"error"}';
        echo ']}';
    }
}
else
{
    echo '{"maal":[{';
        echo '"message":"taken"}';
        echo ']}';
}
?>
Second one:
<?php
include_once("connect_seller.php");
if( isset($_GET['pin'])) {
    $table= $_GET['pin'];
    $query = "SELECT COUNT(status) FROM " . $table . "WHERE status=-1";
    $result = mysqli_query($conn,$query);
    $res = mysqli_fetch_assoc($result);
    if($res["COUNT(status)"] > 0)
    {
        $query1 = "SELECT order_id, timestamp, zip, status, order_status FROM  " . $table . "WHERE status=-1";
        $result1 = mysqli_query($conn,$query1);
        $myArray = array();
        while($row = $result1->fetch_array(MYSQLI_ASSOC)) {
            $myArray[] = $row;
        }
        echo '{"maal":';
        echo json_encode($myArray, JSON_UNESCAPED_SLASHES);
        echo "}";
        }
        else
        {
            echo 'null';
        }
}
?>
 
     
     
    