|
Mysql Question...
Date: 05/06/06
(MySQL Communtiy) Keywords: php, mysql, database, sql
I'm currently developing a small community site (WOW Guild site), and am working on optimizing the database calls and such.
Currently, when a user loads a page the system checks the user's authentication, and then to see who else is online, checks a field in the db to see how many people have a comparable time...:
- user loads page > SELECT * FROM `Members` WHERE `name`=$name AND `pass`=$pass
- update user > UPDATE `Members` SET `lastclick`=$now WHERE `id`=$id
- find other users online > SELECT `id` FROM `Members` WHERE `lastclick` >= $now
I was curious if there was a way to simplify this process... Thanks for anyhelp you guys can give me.
(x-posted: mysql, php_mysql )
****Update: I neglected to mention that $now is stored as 3 minutes in the future, so that the third returns all users registered as authenticated now or 3 minutes from now.
$now is also not a traditional timestamp, but a whole-number representation created from a timestamp.
The code already works, just trying to slim the query number down if possible...
Source: http://community.livejournal.com/mysql/94558.html
|