I'm trying to make a Menu manager in PHP + SQL. My goal is to save every menu item and where it should link to in a seperate row. Every row has an internal identifier column called 'menu_id'.
I also want to add a function to be able to add a row. Therefore, I need to take the highest number available in 'menu_id' and add 1 (if highest is i.e. 24, new one should be 25). Sounds quite simple but I haven't managed to get this working yet, probably because I just started programming in general...
What I have now:
$query = "SELECT MAX(menu_id) FROM hostfx_menus";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
echo $row['MAX(menu_id)'];
}
This indeed outputs the highest number in menu_id. My problem is I still need to add '1' to this result and I have to put it in a form, which is already made up with HTML in a echo();.
Anybody who can help me with these last two points? Thank you very much in advance!