For mysql I use format:
$sql = "select * from table where area_id = ? and item_id = ?";
Then prepare and bind the parameters etc. If the query fails and I log the $sql variable then I get exactly the string above which isn't that useful. What I want is the sql string with the bound values in. As I understand it there is no easy way to do this so I am thinking I can do something like:
sql_log(str_replace('?', array($area_id, $item_id), $sql));
To get something like this in my log:
"select * from table where area_id = West and item_id = West" (spot the error!)
So I know what my error is. But it doesn't work. I get this:
"select * from table where area_id = Array and item_id = Array"