i am new in programming and creating my first dynamic website. and problem i am facing is that when i parse the query in the php for menu of my website it gives only one menu link and hides the other pages created in the database.if i create a new page in mysql the parse code hides the previous page link in the menu and shows the newly created page link. i want to make that every page created in database link is shown in menu. and also guide me what changes i have to do if i want to make menu with sub menu option.
here are the msql code
CREATE TABLE `pages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pagetitle` varchar(255) COLLATE latin1_general_ci NOT NULL,
`linklabel` varchar(255) COLLATE latin1_general_ci NOT NULL,
`pagebody` text COLLATE latin1_general_ci NOT NULL,
`pageorder` int(11) NOT NULL,
`showing` enum('0','1') COLLATE latin1_general_ci NOT NULL DEFAULT '1',
`keywords` varchar(255) COLLATE latin1_general_ci NOT NULL,
`description` varchar(255) COLLATE latin1_general_ci NOT NULL,
`lastmodified` date NOT NULL,
`extra` varchar(255) COLLATE latin1_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=4 ;[/code]
for parsing
[code]$sqlCommand = "SELECT id, linklabel FROM pages WHERE showing='1' ORDER BY id ASC";
$query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error());
$menuDisplay = '';
while ($row = mysqli_fetch_array($query)) {
$pid = $row["id"];
$linklabel = $row["linklabel"];
$menuDisplay = '<li><a href="index.php?pid=' . $pid . '">' . $linklabel . '</a></li>';
and to display menu php code i am using is
<?php echo $menuDisplay; ?>