我试者说说: 首先建立一个消息标:create table notes(....) 字段主要包括 编号: noteid 发送人 fromid 内容 content 发送时间: senddate 接受人:to_id 接受时间:read_date 当某人写短消息时,执行: insert into notes(formid,content senddate,to_id) values('someone','hello i hate you','2003-10-20 02:03:33' ‘fly’); 当任何一个用户登录的时候,都会首先执行一句 select * from notes where to_id='myuserid' and to_date is null; 如果存在新的短消息就闪动短消息图标。除了登陆时执行这句外,还会顶时执行这句,一旦发现就显示跳动。 当 用户 打开短消息时执行一下 update notes set read_date=sysdate; where noteid=‘刚才查出来的noteid’这样下此就不会再闪动了。 一对一的基本可以如此实现。但我不知道别人是否用了更好的方法。另外一对多的话,可以加一个标志字段,区分是否是广播 那么哪个sql可以这样写 select * from notes where (to_id='myuserid' and to_date is null)or radio_flag='Y';不知我说清楚没有?
能说清楚些么
THS
然后用查询语句列出条件为还没有浏览的记录...因为CSDN主页是用框架的.所以在那个网页刷新其它的页面没有影响...//希望能够给你某些触动....@_@
首先建立一个消息标:create table notes(....)
字段主要包括 编号: noteid
发送人 fromid
内容 content
发送时间: senddate
接受人:to_id
接受时间:read_date
当某人写短消息时,执行:
insert into notes(formid,content senddate,to_id)
values('someone','hello i hate you','2003-10-20 02:03:33' ‘fly’);
当任何一个用户登录的时候,都会首先执行一句
select * from notes where to_id='myuserid' and to_date is null;
如果存在新的短消息就闪动短消息图标。除了登陆时执行这句外,还会顶时执行这句,一旦发现就显示跳动。
当 用户 打开短消息时执行一下
update notes set read_date=sysdate; where noteid=‘刚才查出来的noteid’这样下此就不会再闪动了。
一对一的基本可以如此实现。但我不知道别人是否用了更好的方法。另外一对多的话,可以加一个标志字段,区分是否是广播
那么哪个sql可以这样写
select * from notes where (to_id='myuserid' and to_date is null)or radio_flag='Y';不知我说清楚没有?