Forum Moderators: coopster
I`ve set up a database to hold some site info and I want to retrieve it and display it on a page. In this case, its a header option of a text description or a banner.
I`ve created a INT field called h_banner which holds the value 0 or 1, 1 for a banner, 0 for no banner. Then I`ve added some more fields to hold the banner width, height, and the text description if the h_banner field is set to 0 (false).
I`ve then done a function for the header as follows:
function guestbookHeader() {
$query = "SELECT * FROM mg_website";
$result = mysql_query($query) or die ("Error connecting to database.");while ($row = mysql_fetch_array($result));
{
if ($row['h_banner'] == false)
{
echo "<html><head>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">";
echo "<title>$row['w_name'] Guestbook</title>";
include ("styles.php");
echo "</head>";
echo "<body>";
echo "<p align=\"center\">$row['h_text']</p>";
echo "<br>";}
else
{
echo "<html><head>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">";
echo "<title>$row['w_name'] Guestbook</title>";
include ("styles.php");
echo "</head>";
echo "<body>";
echo "<p align=\"center\"><img src=\"$row['h_bannerurl']\" width=\"$row['h_bannerwidth']\" height=\"$row['h_bannerheight']\" border=\"0\">";
echo "<br>";}
}
}
Now basically it doesn`t work. At the moment I`m getting T_STRING errors, but if I correct those, still nothing appears on the page. Neither a text link or a banner. As you can see I`m doing a guestbook script. Well, trying too.
I`m not really sure on the database info.
Any help would be appreciated, thank you.
:)