how can I extend the MySQLi class to explain all SQL queries on a given page?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are several ways to do this. Here is one:
To start, you can get an explanation by simply prepending “EXPLAIN ” to the mysql statement. See http://dev.mysql.com/doc/refman/5.0/en/explain.html for details on Mysql’s
explain.Knowing that Mysql invocation, the
mysqli::queryandmysqli::preparemethods both take their first parameter as the$querystring (side note: just use theReflectionclass in a quick test script to get the current method or construct prototypes. You’ll find extendingmysqli_resultclass is not actually possible, but that shouldn’t be a problem here).Knowing that,