PDA

View Full Version : query in jscript



edryan
January 27th, 2008, 10:41 PM
hi guyz...i have a problem with my query.pls help..

question: Can i put an sql query inside a javascript function?

function blahblah...{
if condition{
//sql query
}
else{
//nothing
}
}

is this possible?plsss..thanks a lot!..

Jeff Wheeler
January 27th, 2008, 10:44 PM
Not really; Javascript is a client-side language and you need to communicate with the server to use a SQL query. Try Googling ‘Ajax’, and you’ll find some interesting results which request data from the server in a similar manner to what you’re looking for.

(That’s not to say that a MySQL driver for Javascript is inherently wrong, it’s just awkward and has never been implemented. Essentially, it’d use Ajax to the server the site was running on, but I suppose connect on a MySQL port and just make plain ol’ text requests and responses. Funky!)