Friday, 13 September 2013

execute mysql query and display results while reading

execute mysql query and display results while reading

I have a mysql database and i want to execute a query and while this query
is being executed the data should be displayed in page.
so for example if i have 1,000 result row from the query result i want to
display each row while the query is being executed instead of waiting till
the query finishes executing then displaying them at once.
here is my php code:
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// Database Name
mysql_select_db("dbname", $con);
$test_query = mysql_query("SELECT * FROM V_Posts where _PID > 100 and _PID
< 10000");
while($CHECK_PCID_R = mysql_fetch_array($test_query))
{
echo $CHECK_PCID_R['_PID'] . "<br />";
}
?>
I tried
echo $CHECK_PCID_R['_PID'] . "<br />";
flush();
But it didn't work :(

No comments:

Post a Comment