Welcome to WebmasterWorld Guest from 54.196.208.6

Forum Moderators: open

Message Too Old, No Replies

Database Connection in JavaScript

connecting to mysql with javascript

     
6:28 pm on Jul 29, 2003 (gmt 0)

New User

10+ Year Member

joined:July 24, 2003
posts:26
votes: 0


Hi everyone,

is there a way to use Javascript to connect to a MySQL database? If so, how? Thanks!

6:36 pm on July 29, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
posts:3732
votes: 0


Not client side javascript. If you are using asp then you can use jscript, but you have to be running IIS. To connect to a database you must use a server-side technology.
7:11 pm on July 29, 2003 (gmt 0)

New User

10+ Year Member

joined:July 24, 2003
posts:26
votes: 0


Okay then,

let's say I want to call a PHP script on the server to connect to the database. But, I have some data that I took in JavaScript that I want to send to the DB. Is there a way to pass data between the two languages?

9:20 pm on July 29, 2003 (gmt 0)

New User

10+ Year Member

joined:June 18, 2003
posts:5
votes: 0


Yes.
If the data you are trying to pass is in a form, then no problem, just set the form action to your php script, then submit the form.

If the data you are getting from your user is not in a <form> (not likely, but possible), then create a form, set action to url of php script, pass the javascript-acquired data to a hidden parameter <input type=hidden .....>, then trigger the submission of the fom with an event handler.