MySQL Forums
Forum List  »  Chinese

怎么实现数据自动更新
Posted by: 萌 柯
Date: December 06, 2006 10:05AM

我想写个php的游戏闯关站,设计的数据库基本结构如下:
tables
users : userid, username, ..., total
-- 这个total是用户游戏的总分,初始值为0

category1 : userid, stage1, stage2, ...,
-- 这里的stage1,stage2都是bool值,默认为0

......

scoresettings: stage1, stage2, ...
-- 这里的数据只有一行,记录了每一关过关所对应获得的分值1*scoresettings.stage2


我想说的是,能不能有方法使users.total=category1.stage1*scoresettings.stage1+category1.stage2*scoresettings.stage2+,,,+category2.stage1*scoresettings.stage1+category2.stage2*scoresettings.stage2+,,,
实现自动更新
例如,我只要更新(update)category1.stage1为1,那么users.total就自动变成category1.stage1*scoresettings.stage1

Options: ReplyQuote


Subject
Views
Written By
Posted
怎么实现数据自动更新
11518
December 06, 2006 10:05AM
6857
December 08, 2006 12:41AM
6921
December 13, 2006 04:01AM
7792
December 13, 2006 05:09AM
7197
February 16, 2007 01:16AM
7934
March 10, 2007 05:53AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.