Jackal Posted October 10, 2006 Report Share Posted October 10, 2006 Ar shito es katru reizi, kad lietotājs kaut ko dara updeitoju redzets lauku: $timestamp = date('Y-m-d H:i:s'); mysql_query("UPDATE users SET redzets = '$timestamp' WHERE nickname = '$username'"); Ar shito es izvelku visus online lietotājus: $datums = date('d-m-Y H:i:s', time() - 10); $kom = mysql_query("SELECT nickname,usersid,redzets,class FROM users WHERE redzets > '$datums'"); Problēma tāda, ka izvelk visus lietotājus, kuri ir online, bet pēc 10 vai vairāk sekundēm, ja lietotājs neko nav darijis, viņu vienalga rāda pie online lietotājiem. Kur ir kļūda? Link to comment Share on other sites More sharing options...
Vebers Posted October 10, 2006 Report Share Posted October 10, 2006 Tur, ka tu no tabulas neizdzēs visus tos lietotājus kuri nav redzēti ilgāku laiku. Link to comment Share on other sites More sharing options...
Jackal Posted October 10, 2006 Author Report Share Posted October 10, 2006 (edited) A kaapēc jādzēš? Es jau prasu lai izvelk tikai tos lietotājus kuri pēdējo 10 sekunžu laikā ir kaut ko darijuši, pārējie nemaz netiek izvilkti. Edited October 10, 2006 by Jackal Link to comment Share on other sites More sharing options...
Paulinjsh Posted October 11, 2006 Report Share Posted October 11, 2006 (edited) tpc, ka tev timestamp katrā gadījumā savādāki :) $timestamp = date('Y-m-d H:i:s'); un $datums = date('d-m-Y H:i:s', time() - 10); Edited October 11, 2006 by Paulinjsh Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 11, 2006 Report Share Posted October 11, 2006 Jackal --> neizmanto SQL laika pierakstu bet INT laukaa Unix timestamp parsauc redzets lauku no DATETIME UZ INT un $timestamp=$time(); $cik_sek=10; mysql_query("UPDATE users SET redzets = '$timestamp' WHERE nickname = '$username'"); //izvelc $kom = mysql_query("SELECT nickname,usersid,redzets,class FROM users WHERE redzets > '".$timestamp-cik_sek."' "); // apmeram shadi Link to comment Share on other sites More sharing options...
GedroX Posted October 11, 2006 Report Share Posted October 11, 2006 Wrong $datums = date('d-m-Y H:i:s', time() - 10); Correct $datums = date('Y-m-d H:i:s', time() - 10); Link to comment Share on other sites More sharing options...
Delfins Posted October 11, 2006 Report Share Posted October 11, 2006 bet anyway, jālieto INT... vismaz kā papildus lauks.. Link to comment Share on other sites More sharing options...
GedroX Posted October 11, 2006 Report Share Posted October 11, 2006 bet anyway, jālieto INT... vismaz kā papildus lauks.. ? Kāpēc? Link to comment Share on other sites More sharing options...
Recommended Posts