Is there anything I have to do on the database end or is it just the php that changes? Can I just substitute mysqli functions for mysql functions? Anything else I should know?
with mysql, you have to use the mysql_select_db once connected, to indicate on which database you want to do your queries. mysqli, on the other side, allows you to specify that database name as the fourth parameter to mysqli_connect . Still, there is also a mysqli_select_db function that you can use, if you prefer.
It is possible to include both MySQL and MySQLi when connecting to a single database, but it is incredibly delicate and with large amounts of data being passed through it can get very messy and hard to control. it is best to use MySQLi in general in my opinion because it is much more secure and up to date.
Basically, MySQL is the old database driver, and MySQLi is the Improved driver. The "i" stands for "improved" so it is MySQL improved. MySQLi can be done procedural and object-oriented whereas MySQL can only be used procedurally. Mysqli also supports prepared statements which protect from SQL Injection.
Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide. Alternatives to this function include: mysqli_select_db()
I advise you to read through this. A lot of helpful information for what you want to do, plus a tool to help. See: Converting to MySQLi.
It's just the PHP that changes.
Everything I know about it says that the only changes you will have to make will be in the PHP. With that said be careful not all functions have the same name between the two so be careful changing from mysql_* to mysqli_*.
The site php.net will be your best friend.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With