Welcome to WebmasterWorld Guest from 34.238.189.171

Forum Moderators: open

Message Too Old, No Replies

run sql in javascript

     
6:14 am on Jul 23, 2007 (gmt 0)

New User

10+ Year Member

joined:July 23, 2007
posts:4
votes: 0


hai,

i'm new here. i'm wondering.. can we put sql query in a javascript code? for example: <javascript> onchange () ... Select * from menu ....</javascript>

thank you!

8:03 am on July 23, 2007 (gmt 0)

Senior Member

joined:Nov 12, 2005
posts:5967
votes: 0


Welcome to WebmasterWorld!

Actually, javascript cannot communicate directly with MySQL - so no. However, you can use Javascript to communicate with the server in the background, then use server-side scripting such as Perl or PHP to run database queries and send the information back to the browser (javascript in this case) in XML format. This is commonly known as AJAX.

Some places you may want to start looking:
Rasmus' 30 second AJAX Tutorial [news.php.net]
The HttpRequest Object [w3schools.com]

good luck

10:26 am on July 23, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 15, 2004
posts:2047
votes: 0


then use server-side scripting such as Perl or PHP

..or JScript.

- This is a Javascript forum after all.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members