开发者

How to do notifications in PHP?

How can I show users that they have a new message or response awaiting in their inbox by showing them a number or text telling them to check it and then o开发者_如何学Gonly remove the notification automatically if the user responds to it or clicks "done" (meaning no further response necessary).


I assume the messages will be stored in a DB. Just add a 'read' boolean column and then query the DB for unread messages to know whether there are new messages.

When the user replies you set the read column to 1.


This really needs javascript. Basically you have javascript make a request every x amount of seconds to a php page that checks for new notifications. Then the javascript alerts the user.


if you wan't something like on facebook, and other social network sites, U need to use javascript to do this. Php is serverside language, and that can;t do.

if you don't ask that, and u are only interested how to solve this with php and database. Try to make new row. Called status, and update table set that coloumn is 1 if is read, 0 if isn't read...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜