I am designing custom query page where user can fire query and get the desired result. In my database I have crores of records obviously it takes time around 10 to 15 minutes to execute . After timeout page gets terminated and code below the php script is not executed so it is not showing below design and footer.
Please let me know how to handle timeout properly so that whole page executes and gives proper user defined timeout message and also below design and footer if execution time exceeds.
Here is what I am trying to do...
<form onsubmit="custom.php;" id="usrform" method="post">
<textarea id="tarea" placeholder=" Example: select malindex,malname,virustype,filetype,count from CT_DETECTIONS;" name="query" form="usrform" style="width:800px;height:100px;"></textarea>
<br>
<br><input type="submit" value="Submit Query" onclick="validate();">
</form>
<br>
<?php
//DB connection
if(isset($_POST['query'])&& $_POST['query']!='')
{
$x = $_POST['query'];
$result = mysqli_query($con,$x);
if(!$result)
{
$msg='<b>Error: </b>Invalid query. Enter a valid query. Please refer to Database Schema <a href="tableinfo.html"><b style="color:black;">here</b> </a>';
}
else
{
$x="<b>Query: </b>" .$_POST['query'];
//fetching rows and drawing google chart table
<?php echo $x;
}
}?>
<div id="valid" style="color:red;">
<?php echo $msg; ?>
</div>
<div style="color:red">
<lable id="myP"> </lable>
</div>
</div>
</div>
<div id="visualization" style="width:800px; height: 450px;color:black;margin-left:22px;"></div>
</div>
</div>
Please let me know how to handle page termination due to timeout