Bhaal Posted February 13, 2007 Share Posted February 13, 2007 Yeah...I know that javascript is client side and PHP is server side - hence the reason I'm posting this. I found a pretty nice MP3 player that can be 'fed' an MP3 by a javascript function. I'm using PHP to query a table, then telling the javascript which MP3 to play based on the results of that query. So... I run a simple select query, then populate a variable: $demoName = "'" . $a2[url_path] . $a2[demo_file_name] . "'"; Then the MP3 player is invoked by the following link: <a href='javascript:void(0);' onclick='javascript:loadFile($demoName);return false;'>Play</a> The function "loadFile" is pretty simple: function loadFile(fil) { thisMovie("mp3player").loadFile(fil); }; (The referenced function "thisMovie" just identifies the instance of the MP3 player.) What I would LOVE to happen is that each time this javascript is run, a counter field for that MP3 is increased by one, something like: $query = "UPDATE mp3s SET count=count+1 WHERE mp3_id=$id" I pretty much understand all that code I just don't know how to make them work "together". Is there a way to run that update query after the javascript function is run? Any help is greatly appreciated! Quote Link to comment Share on other sites More sharing options...
fert Posted February 13, 2007 Share Posted February 13, 2007 look into Ajax Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.