Check my logic

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cto1mac
Forum Commoner
Posts: 54
Joined: Tue Jan 27, 2004 6:11 am
Location: Virginia Beach, VA

Check my logic

Post 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??
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post 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 :?
User avatar
cto1mac
Forum Commoner
Posts: 54
Joined: Tue Jan 27, 2004 6:11 am
Location: Virginia Beach, VA

Post 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
Post Reply