Joe Astrahan Wed Apr 16 14:50:50 -0400 2014

Subject: connection->last_query not filling in the ? values from conditions. How do I see the full SQL query?

Here is some sample code below.

$remote_ip = $_SERVER["REMOTE_ADDR"];
$today_date = $todaydate->format("Y-m-d H:i:s");
$tomorrow_date = $tomorrowdate->format("Y-m-d H:i:s");

$conditions = array('conditions' => array("ipaddress = ? AND dateattempt > ? AND dateattempt < ?", $remote_ip, $today_date, $tomorrow_date));

$attempts = self::find('all', $conditions);

echo "last_query=".self::connection()->last_query;

The query will print out:

SELECT * FROM `insert_tablename_here` WHERE ipaddress = ? AND dateattempt > ? AND dateattempt < ?

The query works successfully but I want to see if the ? values are correctly being formatted and how the SQL will actually looking going to my database for debugging purposes.

How do I do this?