Jump to content

Need Help "Menu Positioning" Approach


bugzy

Recommended Posts

Hello guys I need some input on what's the best approach on this issue.

 

My problem is the menu positioning..

 

I have a table called "page" it has 5 columns

 

page_id - auto increment

page_name

page_content

page_position

page_visibility

 

 

I'm inserting values using this line of codes

 

 

<?php

// Counting how many pages are existing already

$count_query = "Select * from page where page_visibility = 1";

$count_result = mysql_query($count_query,$connection);

$page_count = mysql_num_rows($count_result);

?>



This is what on the html form


<select name="page_position">
    <?php

for($count=1;$count <= $page_count+1;$count++)
	{
		echo "<option value=\"{$count}\">{$count}</option>";
	}
    
    ?>
    </select>

 

 

 

I'm retrieving the page name in the navigation bar with this line of sql code

 

<?php

$query = "Select page_id, page_name from page where page_visibility = 1 order by page_position ASC";

?>

 

 

 

My problem is the column "page_position". For example I have these existing pages

 

Home = ["1" value in column page_position] 1st position

About Us = ["2" value in column page_position] 2nd position

Contact Us = ["3" value in column page_position] 3rd position

Promos = ["4" value in column page_position] 4th positon

 

And I want to add a new page called "New Item" and base on the code above it'll give me 1-5 to positions to choose from. The problem there is if I want to put it on 2nd position, it'll be placed only on the 3rd position because "About Us" page will still have a value of 2 also..

 

anyone how can I fix this base on my code above?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/265489-need-help-menu-positioning-approach/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.