Not sure if this is the correct mailing list to be asking this question but here goes: I've got a prepared statement. $stmt = $dbh->prepare ("insert into test values (?, ?)") or die ("Error: " . $dbh->error); $stmt->bind_param ('ii', $var1, $var2) or die ("Error: " . $dbh->error); $stmt->execute() or die ("Error: " . $dbh->error); Okay I've taken the "or die" statements and put it into a function called 'db_error'. So it looks kinda like this: or db_error ($dbh, $__FILE__, $__LINE__); My db error then prints out "$dbh->error" and FILE and LINE variables so I know exactly where the error is. I would, however, love to print out the actual SQL text that failed. There's no way to determine it, the closest way I can think of is using a $sql variable holding the 'prepare' sql - but that's not what's going to the database. On a mysqli error - I can only see the actual sql that caused the problem on the development system, as mysql logging is turned on on that. It's not possible to turn on on the live system the overhead would probably kill us. Anyone found a way to do this? Peet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php