|
|
|
<?
/** 10/29/1999
This example will constantly refresh your PHP/HTML page.
It is great for displaying realtime information.
Runs under PHP 3.x Tested only using Netscape.
Code expanded from the Pseudo Non Parsed Header example
by Warwick Steve (ukla@mediaone.net)
**/
ECHO "<html><head><title>Constantly refresh your page.</title></head><body>";
ECHO "Starting...<br>";
flush();
sleep(2);
$i=1;
while ($i < 4) { // delay
ECHO "$i<br>"; // Display the counter.
flush();
sleep(1);
$i++;
} // end
// Query your database here. I am using sybase calls.
if (!@sybase_Connect("DATABASENAME, "USERNAME", "PASSWORD")) {
echo "<p><font color=\"red\">Error - Unable to connect to the sybase server. </font></p> \n";
exit;
}
if (!@sybase_select_db("SOMEDATABASE")) {
echo "<p><font color=\"red\">Error - unable to access the specific database. </font></p> \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 "<p>Found $nrows row(s). </p> \n";
if ($nrows > 0) {
echo "<table border=\"1\" width=\"100%\" bordercolor=\"#000000\" bgcolor=\"#C0C0C0\" name=\"displaytable\"> \n";
$x = 0;
/* display the table column headers */
echo "<tr><th bgcolor=\"#6666FF\">FIELDA</th> \n";
echo "<th bgcolor=\"#6666FF\">FIELDB</th> \n";
echo "<th bgcolor=\"#6666FF\">FIELDC</th> \n";
echo "<th bgcolor=\"#6666FF\">FIELDD</th></tr> \n";
while ($x < $nrows) { // display the information
$display_row = @sybase_fetch_row($rs);
echo "<tr> \n";
$display_item1 = $display_row[0];
echo "<td>$display_item1 </td> \n";
$display_item2 = $display_row[1];
echo "<td>$display_item2 </td> \n";
$display_item3 = $display_row[2];
echo "<td>$display_item3 </td> \n";
$display_item4 = $display_row[3];
echo "<td>$display_item4 </td></tr> \n";
$x++;
} // end loop
echo "</table><br> \n";
} // end if nrows
} // end if rs
ECHO "<br><b>In 5 seconds this page will refresh.</b><br>\n";
flush();
sleep(5);
// Now use javascript to send the page to itself.
?>
<SCRIPT LANGUAGE="JavaScript">
history.go(0)
</SCRIPT>
<?
ECHO "</body></html>";
?> |
|
| PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use! Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP | | | A simple class with some HTML output functions that would come in handy for consistent page layout etc. Categories : PHP, PHP Classes, HTML and PHP, HTML, Navigation | | | phpCards - PHP/mySQL postcard script with web based admin to add, edit, and delete cards and categories. Very easy to install. Categories : PHP, Complete Programs, HTML and PHP, MySQL | | | Select with current month Categories : PHP, HTML and PHP, Date Time, Arrays | | | Calendar using Date function Categories : HTML and PHP, PHP, Date Time, Calendar | | | PHP4 session helper HTML file.
Categories : PHP, Java Script, HTML and PHP, Sessions | | | html split bar used to split in multiple pages a database result Categories : HTML and PHP, Databases, MySQL, PHP | | | PageRank Display Categories : Search Engines, HTML and PHP, PHP | | | PHP, simple, counter, bala Categories : HTML and PHP, PHP, PHP Options and Info | | | Automatically printing the contents of an sql table in MySQL. Categories : MySQL, PHP, HTML and PHP, Databases | | | phpWebCam v1.0- Webcam management software - Automatically checks if you're online, and comes with a caption tool capable of handling multiple users. Categories : PHP, Complete Programs, HTML and PHP | | | Dynamic Calender in PHP, Javascript and HTML. Categories : PHP, Java Script, HTML and PHP, Calendar | | | function textwrap will wrap text to any desired width using <BR>\n as the default line break.
Default wrap width is 80 columns.
Categories : Strings, HTML and PHP, PHP | | | Using select multiple with php3 Categories : HTML and PHP, PHP | | | Random quote generator using MySQL and PHP. Allows HTML tags inside quotes and
features a marker so a sigle quote will not be repeated after consecutive page
loads.
Categories : PHP, HTML and PHP, MySQL | |
|
|
|