
$dbh = mysql_connect ("localhost", "sh", "pass") or die (sprintf ("Cannot connect to MySQL [%s]: %s",
mysql_errno (), mysql_error ()));
@mysql_select_db ("MainSite")
or die (sprintf ("Cannot select database [%s]: %s",
mysql_errno (), mysql_error ()));
$sth = @mysql_query ("SELECT * FROM site", $dbh)
or die (sprintf ("Cannot execute query [%s]: %s",
mysql_errno (), mysql_error ()));
$site_info = mysql_fetch_object ( $sth);
function print_header ()
{
global $site_info;
print $site_info->header; 字串4
}
function print_body ()
{
global $site_info;
print nl2br ( $site_info->body);
}
function print_links ()
{
global $site_info;
$links = explode ("\n", $site_info->links);
$names = explode ("\n", $site_info->link_names);
for ( $i = 0; $i < count ( $links); $i++)
{
print "\t\t\t
<a href=\" $links[ $i]\"> $names[ $i]</a>
\n<br>\n";
}
}
?>