I have this in a .php file called function.php i am not able to get anything to display correctly this is what my dba contains. Does anyone know why this would not display to my page.
CREATE TABLE mycontent (
contentID int(3) NOT NULL auto_increment,
menutitle varchar(255) NOT NULL,
content text ,
contenttitle varchar(250) ,
PRIMARY KEY (contentID),
KEY contenttitle (contenttitle)
);
<?
$sql_host="localhost";
$sql_username="root";
$sql_password="xxxx";
$sql_db="mysite";
#Make the sql connection.
$db = mysql_connect($sql_host,$sql_username,$sql_password);
#Select the database
mysql_select_db($sql_db,$db);
function mymenu() {
$result = mysql_query("select * from mycontent");
while ($row = mysql_fetch_array($result)){
$output = "<a href=" . $php_self . "?content=" . $row[contentID] . ">".stripslashes($row[menutitle])."</a>";
echo $output;
}
}
function mycontent($id) {
$result = mysql_query("select * from mycontent where contentID = '$id'");
while ($row = mysql_fetch_array($result)) {
$output = "<h3>$row[contenttitle]</h3>";
$output .="
".stripslashes($row[content])."";
$output .="my site 2001 etc";
}
return $output;
}
?>
<html>
<head>
<title>my first data driven php site</title>
</head>
My CMS
<table>
<tr>
<td valign=top align=left>
<? echo mymenu(); ?>
</td>
<td>
<? echo mycontent($content); ?>
</td>
</tr>
</table>
</html>