rahulkadukar Posted December 13, 2010 Share Posted December 13, 2010 This is my website http://www.rahulkadukar.info/ As you can see I have the blue navigation bar on top and on mouse hover you can see a drop down menu. The contents of the drop down menu can change and I wanted to write a script that would populate the contents of the drop down menus. Which of these is a better option 1. Use JavaScript along with a text file and use JavaScript to populate the drop down 2. Use a SELECT in PHP to populate the drop down menu I am expecting that the 10 main columns would have at the most 20 entries each. Quote Link to comment https://forums.phpfreaks.com/topic/221536-php-with-mysql-or-javascript-with-a-text-file/ Share on other sites More sharing options...
AbraCadaver Posted December 13, 2010 Share Posted December 13, 2010 For users that have JavaScript disabled, 2 would be the best option and would probably be much easier than 1. Quote Link to comment https://forums.phpfreaks.com/topic/221536-php-with-mysql-or-javascript-with-a-text-file/#findComment-1146777 Share on other sites More sharing options...
nafetski Posted December 13, 2010 Share Posted December 13, 2010 The *best* solution would be using MySQL to store the navigation, and PHP to display it. You can still get the dropdown effect without javascript by using CSS...do an unordered list, with a nested menu. Then style li:hover to display the underlying menu items Quote Link to comment https://forums.phpfreaks.com/topic/221536-php-with-mysql-or-javascript-with-a-text-file/#findComment-1146913 Share on other sites More sharing options...
rahulkadukar Posted December 14, 2010 Author Share Posted December 14, 2010 I actually wanted to know which one is faster, so according to you guys, if I want to display dynamic content then a SELECT with MySQL is it faster than Javascript with text file ? Quote Link to comment https://forums.phpfreaks.com/topic/221536-php-with-mysql-or-javascript-with-a-text-file/#findComment-1147056 Share on other sites More sharing options...
nafetski Posted December 14, 2010 Share Posted December 14, 2010 Well I don't know why you would use javascript at all. A mysql query for something as simple as a menu might slow you down 30ms...but if you are building the menu (and don't want to gow ith a database) you would be better of going with a text file with PHP than javascript. Quote Link to comment https://forums.phpfreaks.com/topic/221536-php-with-mysql-or-javascript-with-a-text-file/#findComment-1147196 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.