I want to know how to view the SQL query held by a MySQLi_STMT object.
I'm using an object of type MySQLi_STMT and I want to inspect the SQL statement associated with the object. I set the SQL query using the
mysqli_stmt::prepare ( string $query )
function. I then call the
mysqli_stmt::bind_param( string $types , array $params )
function to bind parameters in the query. I want to ensure that the binding was done correctly by inspecting the mysqli_stmt object. However, upon viewing the class's instance fields, none of them hold the newl开发者_如何学Pythony-bound query. $errno is 0 and $sqlstate is '00000' so it doesn't seem like there's an error, but
mysqli_stmt::execute()
keeps returning null, as opposed to returning false as the documentation says it should, leading me to believe that there is a syntax error in the query. Again, $errno is 0 and $sqlstate is '00000' after the execute() call so it doesn't appear that an error occurred, but I'd still like to know how to access the query being stored in the mysqli_stmt object.
Well, according to http://www.phpfreaks.com/forums/index.php?topic=263790.0, you really can't get to the underlying query. In my opinion, this is a serious omission in the class definition. Pity...
精彩评论