Web Hosting Talk







View Full Version : Javascript-MySQL Interaction


Jong
07-25-2005, 04:27 AM
Is it possible to create a _javascript include file that inserts into a MySQL database where one needs to be called from a hyperlink and another for the pages load (impressions) and take the following parameters?

Id
CountryId / Name
Date
Action (Click, Impression) - Just a number that will be aligned with the action
Media (Text, Banner, Small Image, Large Image) - Just a number that will be aligned with the media
UserIP - The users ip address

Also, is it possible for this _javascript to create a log that is read daily and then emptied?

chrisranjana
07-25-2005, 07:31 AM
One way is for

javascript --> php script residing in server --> accomplish what you want to do

gogocode
07-25-2005, 10:08 AM
Javascript is client side (well, typically, but lets not get into that). MySQL is server side.

There can be no *direct* interaction between them, interaction must go through the browser to a server side reciever into mysql and back again.

I'd use
Javascript <-> XMLHTTPRequest <-> PHP <-> MySQL
you could also use the traditional
Javascript <-> iframe/frameset "pipe" <-> PHP <-> MySQL
or substitue your favourite language for PHP

michael-lane
07-25-2005, 12:52 PM
i hear theres an activexobject that does mysql commands but its like 10 lines just to connect and another 5 to select a database but i cant remember the url i found it at.