Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to use JS to connect to mySQL?

Status
Not open for further replies.

rhodesiascout

Programmer
Oct 27, 2000
7
GR
hi guys

Is it possible to use javascript to connect to a mySQL database?
How?
Also how do i SELECT data from the database using javascript?
 
No.

.
.
.
.

OK, I know that's not what you wanted to hear..., but the solution's not too hard. If you have a PHP installed on your server, it's quite easy to select data from MySQL and create a Javascript array out of that data.

If you don't have PHP installed on your server... it's usually very easy, either for a Windows server or a Unix one. (as a plus, PHP's syntax is a lot like Javascript) If you still don't want PHP, then you can use Perl or ASP to do the job, but it will be a little more work.

Without a server-side programming language you can't just access data from the server's database.

One reason I think many have gotten the idea that you can get data via Javascript is that dang-blasted Microsoft technology known as 'data-binding', which let's IE use a simple bit of client-side script along with some weird mix of ActiveX, ODBC, Java, or what-have-you. It's not highly recommended for an enterprise server, and it doesn't work with Netscape or any other browser besides IE/Win.

I suppose if you really wanted to go around Jupiter to get to the Moon, you could install MySQL on a Windows NT server, use MyODBC, and possibly manage some data-binding, but PHP would be so much easier, and would work for any browser.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top