0

Because I'm new to php I need help with some web page menu that is stored in MySQL database and then called to page with php. My PHP connection to database works well, and menu looks like it should but I don't know how to make links to pages from menu. Example: when menu is populated it would give me home, about, gallery the problem is how to make them links to specific pages like about.php? here is the code:

<?php
include('testconnect.php');
//calling menu from database
$query_sql = "SELECT * FROM meni";
$item_query = mysql_query($query_sql) or die(mysql_error());
$rsitem = mysql_fetch_assoc($item_query);
?>
<! DOCTYPE html>
<html>
<head><title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link rel="stylesheet" href="style2.css" type="text/css" />

</head>
<body>
<nav>
<ul>
 <?php
 do {
 ?>
 <li><a href="menutest.php?meni_ID=<?php echo $rsitem['meni_ID']; ?>"><?php echo      $rsitem['item']; ?></a></li>
<?php    
}while ($rsitem = mysql_fetch_assoc($item_query));
?>
</ul>
</nav>
</body>
</html>

I put that menutest.php in link just to see if it works. MySql database has two fields meni_ID which is integer and item vhich is varchar. any kind of help would be good. or even example of other similar post. Thank you!

youngster
  • 195
  • 1
  • 12
  • I,ll try to be more specific. Everything is good, menu is populated from database. I need to make them links to other pages. Example: populated menu is: home, about, gallery I need them to get me, when I click on them, to about.php... – youngster Mar 31 '13 at 20:58
  • You should edit your question to reflect that. – Hugo Dozois Mar 31 '13 at 21:00