Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    stampare secondi da ultimo datetime

    ciao ragazzi. io ho un campo datetime_lastping che mi serve per mantenere attivo un utente tra i presenti. nel login faccio in modo che impedisca l'accesso se sono passati meno di 5 minuti dall'ultimo ping. Fin qui nessun problema.

    Ora vorrei stampare i secondi restanti allo scadere dei 5 min, qualcosa tipo "puoi loggarti tra 250 secondi". Ora io c'ho provato, ma dati i risultati mi sa che sbaglio sicuramente

    cmq veniamo al codice:

    Codice PHP:
         $sql="SELECT *,(NOW() - datetime_lastping) as Resto FROM presenti WHERE NOW() - INTERVAL 5 MINUTE < datetime_lastping  AND Nick='$Nick'";
     
    $query=mysql_query($sql,$db); 
                        
    $toc mysql_fetch_array($query); 
                        
    $num2 mysql_num_rows($query);
    if(
    $num2 '0') {
    echo
    "Loggati tra $toc[Resto] secondi"; }

    } else { 
    ok 
    sbagliato sicuro eh?
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  2. #2
    up
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  3. #3
    così nemmeno va

    Codice PHP:
        $sql="SELECT *,UNIX_TIMESTANP() - UNIX_TIMESTAMP(datetime_lastping) as Resto FROM presenti WHERE NOW() - INTERVAL 5 MINUTE < datetime_lastping  AND Nick='$coc[Nick]'"
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  4. #4
    up
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  5. #5
    nisba?
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.