I want to build up a website. I have a large database. Its impossible to make thousands of Html pages. Can Java script make them automatically from my database?
Plz help me.
I think that you’ll want to look into languages like PHP and ASP.
I don’t think JavaScript can do what you want, as it operates on the client side, not the server (where the database is). If you’re proficient in JS though, PHP shouldn’t be too big of a step to learn. Plus it’s free.
You need a server side scripting language. javascript runs on the users browser so once the page is there its too late to change the content (not really but conceptually).
Have a look into PHP. it is open source (free) and the most widely used language. it also has many extensions for database connections. The purpose of php is exactly what you’ve said, you cant make thousands of html pages so php and othes like ASP and JSP dynamically create them.
While it would be possible, it is a very bad way to of doing this. Javascript is client side, so any of your connection settings (server, username, password) would be exposed to the client. Not to mention the HUGE risk of make SQL injection trivial for anyone who can right click > view source.
Another reason is performance, making many round trips to a database from the client to generate an HTML page would be very time consuming and very hard on the database. Because you would not be able to cache the results in Javascript, you would be calling the database to construct the page every time someone views it.
What you want is a server side language (PHP, C#, etc…). Any of these languages will allow you to create dynamic pages.
For example, if you have a parts table and want to view details of a part:
In HTML pages, you go to parts_details_XXX.html (requiring lots of HTML pages)
In PHP (or others), you go to parts_details.php?id=XXX (requiring one PHP page)
While creating a website with this functionality is not easy a simple thing to do, it is highly perferable and a much better solution to lots and lots of HTML pages.
August 12th, 2007 at 3:00 am
I think that you’ll want to look into languages like PHP and ASP.
I don’t think JavaScript can do what you want, as it operates on the client side, not the server (where the database is). If you’re proficient in JS though, PHP shouldn’t be too big of a step to learn. Plus it’s free.
August 13th, 2007 at 1:45 am
I don’t think so. You must embed the codes (Javascript or VBscript) to a scriptting programming language like ASP (Active Server Pages)
August 14th, 2007 at 7:55 pm
Javascript wont be able to do it because it is a client side language. You can definitely do it with PHP, Perl or another server side language.
You will need a script that access the database using some queries and then display the returned data in whatever way you want.
August 15th, 2007 at 8:33 pm
You need a server side scripting language. javascript runs on the users browser so once the page is there its too late to change the content (not really but conceptually).
Have a look into PHP. it is open source (free) and the most widely used language. it also has many extensions for database connections. The purpose of php is exactly what you’ve said, you cant make thousands of html pages so php and othes like ASP and JSP dynamically create them.
August 18th, 2007 at 4:43 pm
Yes, if you use it with PHP. You should just use PHP, though.
August 21st, 2007 at 12:48 pm
While it would be possible, it is a very bad way to of doing this. Javascript is client side, so any of your connection settings (server, username, password) would be exposed to the client. Not to mention the HUGE risk of make SQL injection trivial for anyone who can right click > view source.
Another reason is performance, making many round trips to a database from the client to generate an HTML page would be very time consuming and very hard on the database. Because you would not be able to cache the results in Javascript, you would be calling the database to construct the page every time someone views it.
What you want is a server side language (PHP, C#, etc…). Any of these languages will allow you to create dynamic pages.
For example, if you have a parts table and want to view details of a part:
In HTML pages, you go to parts_details_XXX.html (requiring lots of HTML pages)
In PHP (or others), you go to parts_details.php?id=XXX (requiring one PHP page)
While creating a website with this functionality is not easy a simple thing to do, it is highly perferable and a much better solution to lots and lots of HTML pages.