I am trying to make a website menu using PHP and MySQL and Javascript / AJAX. Would it be more efficient to cut MySQL out of the picture and use arrays to to define the menu items? Example : //*** Menu Options ***\\ //*** About Us ***\\ $about[0] = "About Us"; $about[1] = "Contact Us"; $about[2] = "News "; $about[3] = "Testimonials"; //*** Services ***\\ $services[0] = "Services"; $services[1] = "Internet Access"; $services[2] = "Web Hosting"; $services[3] = "Network Consulting"; //*** Support Center ***\\ $support[0] = "Support Center"; $support[1] = "Dial Up"; $support[2] = "DSL"; $support[3] = "Wireless"; $support[4] = "E-Mail"; $support[5] = "Security"; $support[6] = "Web Hosting"; $support[7] = "Network Information"; $support[8] = "Download Software"; //*** Members Area ***\\ $members[0] = "Members Area"; $members[1] = "E-Mail"; $members[2] = "LD Rates"; PHP: Or would it be more efficient to use a MySQL table and get the menu items from there. I dont have an example for the MySQL menu because I havnt gotten that far yet in my learning.
Well when ever somebody has to add a menu item she will have to search you to hard code....and upload this may be menu.php using some ftp client... where as with mysql option...a novice user can use a admin gui to add an item
So, I would create a table for each different section of the menu, and add value according to the sub menus? I then would call a query to fill the tables?
PHP would be more efficient in terms of processing time but MySql would mean that it is more flexible. If you were doing it just the PHP way you may as well cut out the PHP part?
You can use MySQL and cache the result. That way the menu info can be read once and cache as long as you want it to expire (or expire it whenever you make changes). Its fast and flexible. If you run Linux, you can try memcache or memcached. If you run Windows, then use wincache