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...:



    1. user loads page > SELECT * FROM `Members` WHERE `name`=$name AND `pass`=$pass



    2. update user > UPDATE `Members` SET `lastclick`=$now WHERE `id`=$id



    3. 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: '[info]'mysql, '[info]'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

« moving hosts || looking for a good, free... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home