PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 24th, 2006, 07:59 PM
ryon420's Avatar
ryon420 ryon420 is offline
Comp. Sci. version of Dr House
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2006
Location: Was lost, then found, now lost again.
Posts: 3,744 ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 1496 Folding Title: Novice Folder
Time spent in forums: 7 Months 3 Weeks 4 Days 9 h 23 m 24 sec
Reputation Power: 1908
Send a message via MSN to ryon420 Send a message via Google Talk to ryon420
Question about updating users online.

Hi all.

I have some code, and it suppose to update users to offline every so often. But I'm not sure if it would work.
PHP Code:
 $inactive time()-3600
//Wouldn't this never work
$sql->query("UPDATE " pref "users SET online='No' WHERE inactive < $inactive");
//Because it always updates everytime
$sql->query("UPDATE " pref "users SET inactive='$inactive'"); 


Am I wrong or what?
__________________
"And what, Socrates, is the food of the soul?

Surely, I said, knowledge is the food of the soul." -- Plato

Reply With Quote
  #2  
Old December 24th, 2006, 08:18 PM
Sepodati's Avatar
Sepodati Sepodati is offline
Banned
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Dec 1999
Location: Kentucky
Posts: 14,429 Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)  Folding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced Folder
Time spent in forums: 3 Months 1 Day 17 h 21 m 55 sec
Reputation Power: 2546
Send a message via ICQ to Sepodati Send a message via Yahoo to Sepodati
Why do you need to mark people offline? Why not just count everyone that's been active within the last X minutes as online? Anyone that's inactive... well, is inactive. You don't care. No need for an "online" column at all, which is a waste anyhow.

$inactive is an integer, so don't use quotes around it in the query, also.

Are you updating the "inactive" column each time the user does something?

---John Holmes...

Reply With Quote
  #3  
Old December 24th, 2006, 08:30 PM
ryon420's Avatar
ryon420 ryon420 is offline
Comp. Sci. version of Dr House
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2006
Location: Was lost, then found, now lost again.
Posts: 3,744 ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)ryon420 User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 1496 Folding Title: Novice Folder
Time spent in forums: 7 Months 3 Weeks 4 Days 9 h 23 m 24 sec
Reputation Power: 1908
Send a message via MSN to ryon420 Send a message via Google Talk to ryon420
Quote:
Are you updating the "inactive" column each time the user does something?


Yes. I think I have it straight now. Thanks!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Question about updating users online.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT