PHP in Real Time

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
mcfoo
Forum Newbie
Posts: 2
Joined: Mon Mar 15, 2004 7:43 pm

PHP in Real Time

Post by mcfoo »

Hi,

I would like to know if anyone had done PHP in real-time?
Meaning that given a web page, any updates to the database would automatically trigger a refresh to the page that i'm viewing...

Is this achievable?

Thanks a million for any help given! :D

regards,
mcfoo :D
coreycollins
Forum Commoner
Posts: 67
Joined: Sun Feb 01, 2004 1:04 pm
Location: Michigan

Post by coreycollins »

I don't know if that is possibable. The best suggestion I would have is to have a refresh timer and have your page refresh every few minutes or seconds.

Corey
http://www.savance.com
http://www.coreycollins.com
Goowe
Forum Commoner
Posts: 94
Joined: Mon Mar 15, 2004 9:51 am
Location: Southeast Alaska

Post by Goowe »

As far as I know, it's not possible with PHP alone. Perhaps another user here could help with another language to get it to refresh and check the database constantly... sorry, I don't know much about anything other than PHP and some HTML... :roll:
mcfoo
Forum Newbie
Posts: 2
Joined: Mon Mar 15, 2004 7:43 pm

Post by mcfoo »

Hmmmm...

A refresh-timer is not good enough... :(
It has to be real-time...

Tat's why i'm sourcing for other technologies...
I saw one being done in Java, but i'm unwilling to venture into that area, as PHP is still my core programming skills, not to mention PHP is way faster... :)

hmmm, have to wait to see if any other PHP gurus reply to this thread... *pray*
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

http://code.jenseng.com/jenChat/

Its a php-based real-time chat. While it does use a refresh, it does it in an iframe, which 'hides' the flicker, and effectively makes it completely realtime. Very nifty.

Alternatively, there IS a method involving server-side Javascript for this exact issue, but when I last read it, it was FAR beyond my knowledge, and I can't seem to find the link for it anymore.
penguinboy
Forum Contributor
Posts: 171
Joined: Thu Nov 07, 2002 11:25 am

Post by penguinboy »

This cannot be done with PHP;
PHP is a server side language.

Your only options are: Meta-refresh, javascript.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

It certainly is possible, but PHP itself cannot and does not monitor the database for updates. It's the database itself that would need to trigger an event-bubble.

MySQL can't do that - but SQLite should be able to as you can have stored procedures that can get "triggered", somewhat like Oracle. Not sure about other open source databases like Postgres.
Post Reply