Hi,
I seem to be having some problem with the output from php. From the
sql below, I only receive a web page showing the result line "Total # of records show 999"
but without any header which I have declared as $hheader.
FROM MY TEST.PHP FILE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<?PHP
$ttitle = "MySql test";
$hheader = "The web site";
include ("test.inc");
html_begin ();
test_db_connect()
or die ("Cannot connect to server");
mysql_select_db(bdhsa);
or die ("database not available");
I have remarked this due to error from php.
Shouldn't there be a check on the tables?
$result = mysql_query ("select count(*) from bdhsa")
or exit ();
if ($row = mysql_fetch_array ($result))
echo "<p>Total # of records show ", $row[0], ";
mysql_free_result ($result);
html_end();
?>
FROM MY TEST.INC FILE
<?php
##################################################################
#######
####### My mysql functions
#######
##################################################################
function test_db_connect()
{
$link = @mysql_connect ("my.net","user","jaytee");
if ($link && mysql_select_db ("test"))
return ($link);
return (false);
}
function html_begin()
{
echo ("\n");
echo ("<head>\n");
if ($ttitle)
echo ("<title> $ttitle </title>\n");
echo ("<meta name='Author' content='P.B.">\n");
echo ("</head>\n");
echo ("<body link='#0000FF' vlink='#800080' leftmargin=35
bgcolor='#f5ebda'>\n");
echo ("<br><center>\n");
echo ("<font face='Verdana,Geneva,Arial,Helvetica,sans-serif'
size='+1' color='Teal'>\n");
if ($hheader)
echo (" $hheader \n");
echo ("</font></center><br>\n");
echo ("<br><br>\n");
}
function html_end()
{
echo ("</body>\n");
echo ("\n");
}
?>