Two other issues just came to my mind, hope you don’t mind
-
starting from 5.4,
mysqli_result
class implements Traversable interface and thus you can foreach over it directly, just like a statement in PDO. The way I learned it is described in my other answer. -
the greatest thing about mysqli I’ve learned so far is that it is able to throw exceptions on SQL errors. I was puzzled though, how to make it work without throwing warnings from mysql server as well, for most of them are rather pointless. It took me a lucky accident of finding a PHP bug (which is now deleted) where it was described that configuration options for
mysqli_report()
form a bit mask. After that I was able to conjure the proper syntax:mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
it looks not that obvious but works perfectly.
I am trying to advertise this amazing feature on Stack Overflow but without much success. It looks like that notorious or die()
will die only with PHP itself…