can anyone please tell me how come the following code doesn't work? I have tested it with the php only and it went ok, there was a connection to the database.
somehow with the combination to the html the php code appears to be in a box that says php.
I changed the password for this display ofcourse!
<?php
$db=mysql_connect("localhost","root","password");
if(!$db)
{
die("database connection failed: " . mysql_error());
}
$db_select = mysql_select_db ("widget_ori", $db);
if (!$db_select)
{
die("database selection failed: " . mysql_error());
}
?>
<html>
<head>
<title>Widget Corp</title>
<link href="stylesheets/public.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<h1>Widget Corp</h1>
</div>
<div id="main">
<table id="structure">
<tr>
<td id="navigation"><?php
$result= mysql_query ("SELECT * FROM subjects", $db);
if (!$result)
{
die("database selection failed: " . mysql_error());
}
while ($row = mysql_fetch_array($result))
{
echo $row["menu_name"]." ".$row["position"]. "<br />";
}
?>
</td>
<td id="page">
<h2>Content Area</h2>
<p>Welcome to the staff area.</p>
<ul>
<li><a href="content.php">Manage Website Content</a></li>
<li><a href="new_user.php">Add Staff User</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</td>
</tr>
</table>
</div>
<div id="footer"> Copyright widget ori 2011 </div>
</body>
</html>
<?php
mysql_close($db);
?>