PDA

View Full Version : How to integrate javascript with php/mysql


tomhilton
04-18-2003, 07:14 PM
Hi, I work with php and mysql and want to use javascript's setimeout function to periodically retrieve information from a mysql database and update to a web page.

I've used the meta refresh tag before to do this, but I want to refresh once/minute, and don't like refreshing an entire screen like this, so often. Can anyone point me in the right direction to find out how to pass php variables to javascript and vice versa, or any common sense ideas on how to accomplish this? Thanks very much.

redhead
04-18-2003, 07:23 PM
javascript (outside asp) is client side, it cannot connect to databases, etc... php is server side, you cannot mingle them both together, unless you are getting a variables data from the php script... like...

<script>var geek = <?php print $geek; ?></script>

if you see what i mean, if not, read into what both the languages can and cant do. i dont know a way other than refreshing the page to do what you want... :thumbsup: