This post will show you how to convert PHP mysql extension functions to PHP MySQLi extension. Migrating away from ext/mysql to MySQLi (or PHP Data Object (PDO)) is important, because the ext/mysql functions are deprecated as of PHP 5.5.0. If you do not update your PHP code, your website will fail soon!
The PHP MySQLi extension supports multiple queries, which are concatenated by a semicolon, with
mysqli->multi_query. We use this to optimize all MySQL tables, in a single multi-query statement. Neat! Optimizing MySQL tables is important to keep tables small and fast. This boosts MySQL, PHP and website performance and we all love that, don’t we? :)