Page 1 of 1

Check my logic

Posted: Mon Feb 16, 2004 7:25 pm
by cto1mac
I am trying to build a page that will refresh only when needed not manually, or on a timeout. So I have this idea to do something like this:

<body onLoad="setTimeout("<?php refresh_function(); ?>" , 5000);">

Then writing a php function to scan the database every few minutes and if the database has been updated then refresh the page but if not just continue until the next refresh dictated by the javascript setTimeout function.

Can this work??

Posted: Mon Feb 16, 2004 7:37 pm
by DuFF
Sorry but no. PHP is server-side only which means that the server parses it and then sends it to the client. The function could only be evaluated if the page was refreshed :?

Posted: Mon Feb 16, 2004 7:50 pm
by cto1mac
dang it,

Well that just stinks. I was hoping to avoid a constantly refreshing page that would interrupt form values being inputted or requiring people to constantly refresh their own pages manually. is there a way to make php do a timeout type check??

Thanks