Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Daty ...
Spirit86
post
Post #1





Grupa: Zarejestrowani
Postów: 607
Pomógł: 23
Dołączył: 8.09.2004
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


witam, napisałem następujący kod:
  1. <?php
  2. $re = mysql_query(&#092;"SELECT id, id_2, id_1 FROM tableafsad WHERE date < DATE_SUB( CURTIME() , INTERVAL 24 HOUR) AND status='0'\");
  3. while($r = mysql_fetch_array($re)){ 
  4. ?>

no i nie wiem, czemu nie dostaję żadnych rezultatów :|
Chcę aby pobierał mi rekordy, które są starsze niż 24 h.
kolumna date to DATETIME
Pozdrawiam
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
dr_bonzo
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 5 724
Pomógł: 259
Dołączył: 13.04.2004
Skąd: N/A

Ostrzeżenie: (0%)
-----


Cytat
CURTIME()Returns the current time as a value in 'HH:MM:SS' or HHMMSS format, depending on whether the function is used in a string or numeric context.

NOW()Returns the current date and time as a value in 'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS format, depending on whether the function is used in a string or numeric context.

CURTIME zwraca tylko godzine, a NOW cala date. Co przy traktowaniu tego jak liczby otrzymasz curtime = 0000000HHMMSS co jest zawsze mniejsze od np 20050130HHMMSS.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 8.10.2025 - 14:19