ECHO "Constantly refresh your page. ";
ECHO "Starting...
";
flush();
sleep(2);
$i=1;
while ($i < 4) { // delay
ECHO "$i
"; // Display the counter.
flush();
sleep(1);
$i++;
} // end
// Query your database here. I am using sybase calls.
if (!@sybase_Connect("DATABASENAME, "USERNAME", "PASSWORD")) {
echo "Error - Unable to connect to the sybase server.
\n";
exit;
}
if (!@sybase_select_db("SOMEDATABASE")) {
echo "Error - unable to access the specific database.
\n";
exit;
}
$query_get_info = "SELECT FIELDA, FIELDB, FIELDC, FIELDD FROM SOMETABLE ORDER BY FIELDA";
$rs = @sybase_query($query_get_info); // execute the query
if ($rs) { // ok
$nrows = 0;
$nrows = @sybase_num_rows($rs);
echo "Found $nrows row(s).
\n";
if ($nrows > 0) {
echo " \n";
$x = 0;
/* display the table column headers */
echo "FIELDA \n";
echo "FIELDB \n";
echo "FIELDC \n";
echo "FIELDD \n";
while ($x < $nrows) { // display the information
$display_row = @sybase_fetch_row($rs);
echo " \n";
$display_item1 = $display_row[0];
echo "$display_item1 \n";
$display_item2 = $display_row[1];
echo "$display_item2 \n";
$display_item3 = $display_row[2];
echo "$display_item3 \n";
$display_item4 = $display_row[3];
echo "$display_item4 \n";
$x++;
} // end loop
echo "
\n";
} // end if nrows
} // end if rs
ECHO "
In 5 seconds this page will refresh.
\n";
flush();
sleep(5);
// Now use javascript to send the page to itself.
?>
ECHO "";
?>