Mysql
 sql >> Base de données >  >> RDS >> Mysql

Différence entre 2 champs adjacents - Date - PHP MYSQL

Modifiez les variables pour votre implémentation, mais cela devrait parcourir la table.

<?PHP


    $db_handle = mysql_connect($server, $user_name, $password);
    $db_found = mysql_select_db($database, $db_handle);


    if ($db_found) {

        $SQL = "SELECT dte FROM tb_name";
        $result = mysql_query($SQL);

    while ($db_field = mysql_fetch_assoc($result)) {
        print date_diff($db_field['dte'], $datetime2) . "<BR>";
        $datetime2=$db_field['dte'];
    }

    mysql_close($db_handle);

}
else {
    print "Database NOT Found ";
    mysql_close($db_handle);
}

?>