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

string debug(void)

This method simply returns the last executed query in a highlighted style. This is useful for debugging: When you write long SQL queries that include content from variables and functions, it is sometimes hard to get an overview of the actual string that you're passing on to the SQL server. By using the debug() method you get a nicely formatted output of the SQL query.

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

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

# Selecting the products bought by a particular customer within the
# last 24 hours:
$db->query("SELECT
    products.name AS product_name,
    users.first_name AS first_name,
    users.last_name AS last_name
FROM
    products,
    users
WHERE
    users.id = '"
.addslashes($_REQUEST["user_id"])."' AND
    products.user_id = users.id AND
    "
.$db->unix_timestamp("products.purchase_date")." >= ".(time() - 86400)."
ORDER BY
    products.name"
);

echo 
$db->debug();
?>