PDA

View Full Version : Using the Javascript with a connection from the database.



MrSheen
06-07-2007, 12:22 PM
Hey im looking to create a javascript table:

Basically, i want it to echo the contents of the MYSQL table.

How could i do this with JAVASCRIPT. Not HTML.

mburt
06-07-2007, 12:52 PM
You can't do this with JavaScript. A server side language is needed, such as PHP or ASP. (JavaScript is client-side: executed after the page loads).
With PHP you simply have to connect to the database (using username, password, and domain) and then echo db contents, then close the database. Simple.

MrSheen
06-07-2007, 01:05 PM
Ok then, so i have created my PHP script to connect to the database.

So how do i make the javascript fetch information from the database?

djr33
06-09-2007, 03:54 AM
Populate the javascript with data when the php parses the page, or look into AJAX to call PHP dynamically