Hidden my id

i just finished my website my design as below
-menu_id (primary key)
-menu_id (foreign key)
-sub_menu_id (primary key)
when i click the menu it display my menu_id
how to hide this id i try to used uniqid() but it have problem with my sub menu because it call an id from menu then compare in database any good solution for this? i wan to use md5 or uniqid to hide it

Why? I mean, you CAN do it, but… why? Whats the difference between id=1 and id=129038823129387abbcff

Most people go the other way and use a user friendly slug:


slug //used to search for pages and pull it up

http://localhost/index.php?menu_id=1 then becomes http://localhost/index.php?slug=my_page_slug, and then further you can use mod rewrite to change this to http://localhost/my_page_slug

Or for simpler terms you could go from http://localhost/my_menu_name/1 to http://localhost/index.php?menu_id=1 so that you don’t have to alter your code to convert your menu name to its id, you can simply read the id from the URL still.

i think because of my function compare
SELECT * FROM tblmenu WHERE menu_id = 129038823129387abbcff
that why it not work if i substr($strid,0,1) but when the number reach about 10,100,1000 how i gonna do?

Dear K.Wolfe, cpradio
yes i did here my rewrite url
RewriteEngine On
RewriteRule ^index.php$ index.php?menu_id=$1 [QSA]
#RewriteRule ^([a-z]+)$ menu.php?ph_sc_menu_id=$1
it not working also and i already test
RewriteRule index.htm index.php [L] #it point to index.php it mean my mod_rewrite work
now i have no choice because my domain and hosting waiting for me that’s why i almost crazy :frowning:


This is just wrong:

If you want your display url to be long, then you need to make your ID in the table that long ID, dont run some sort of substr() or anything similar.