:: Forum >>

How to use javascript to connect DATABASE

My development is using PHP. How to connect to database with Javascript instead of PHP script.
Database using is MySQL
achsiung
Monday, December 6, 2004

Well, how can you print from monitor?

You simply can't. But if you take a snap-shot and then direct it to real printer, you can :-)

Your answer is similar. You write some server-side php which can do DB activity on behalf of your call from JavaScript. You can use Active.HTTP.Request to call server-side php from javascript.

Something similar is suggested somewhere in forums. Look for it...

Cheers,
Sudhaker Raj
Tuesday, December 7, 2004
hellow to all my friends
larry
Wednesday, September 7, 2005
javascript is not server side technology, u can't talk javascript directly to php
Wednesday, September 7, 2005
I think it is possible only on netscape browser.
Risha
Monday, September 12, 2005
hello....to all friends.....please help me...
How can I store data in database from HTML page
OR
How can we call a database server in HTML
Wednesday, January 4, 2006
as mentioned above: use PHP
kbazsi
Wednesday, January 4, 2006
Most of you guys have it all wrong. (not all)

Here is how it works

You MUST (and there is no argument here) have a server side language to communicate with the DB
ex. PHP, ASP, JSP, Python or something along those lines

Then you have JS and HTML, which are rendered into your browser.

You can use JS to call PHP pages in the background via XMLHttpRequest, which can return data from a database in any format you format the script to display the data. Whether it be JS, XML, HTML, or what ever, that will be returned from the script you called, this is also known as AJAX. Then you do what you need with the returned data.

I guess if you don't understand most of the things I am talking about, then you need to do some Googling on these topics to get a better understanding.

Topics are:
AJAX
XMLHttpRequest
Javascript
PHP
Tony
Wednesday, January 4, 2006
"You MUST (and there is no argument here) have a server side language to communicate with the DB
ex. PHP, ASP, JSP, Python or something along those lines"

Not strictly true! ASP can be javascript or vbscript run at the server. You can use databases by mixing the javascript with the ASP to use the database. The javascript however can be run at the server - you just remove the alerts and the document outputs.
Tryf
Thursday, April 6, 2006

"You MUST (and there is no argument here) have a server side language to communicate with the DB

yes it is true, and ASP is a serverside language "but it sucks". Why would you go confusing the newbies telling them they can use javascript to comunicate with the db. Javascript should stay client side but that's microsoft for ya, I wonder why Tony didnt mention ASP??? lol
Swisher
Thursday, October 26, 2006

This topic is archived.


Back to support forum

Forum search