F a s d a b
Fast and simple database abstraction
unix_timestamp

string unix_timestamp(string column)

For MySQL, this method returns the string "UNIX_TIMESTAMP(column)". For PostgreSQL, it returns the string "EXTRACT(EPOCH FROM column)".

<?php
require_once("fasdab.mysql.php");

$db = new Fasdab("localhost""username""password""database");

$db->query("SELECT ".$db->unix_timestamp("date")." AS date, author, entry FROM guest_book");

# We want the date to be displayed in Danish:
setlocale(LC_TIME"da_DK");

while (
$row $db->row()) {
    
# Formatting the date we received from the database:
    
$date strftime("%e. %B %Y"$row->date);

    echo 
"Date: $date<br/>\n";
    echo 
"Author: ".htmlspecialchars($row->author)."<br/>\n";
    echo 
"Entry: ".htmlspecialchars($row->entry)."<br/>\n";
}
?>