Hey guys.... I recently upgraded my PHP on my local and production server from 4.4.3 -> 5.2.1. For the sake of staying modern, it would be nice to update all my code to reflect the new mysqli extension as opposed to all the code I've written with the standard mysql functions (ie. mysqli_connect() compared to mysql_connect(), etc.).
Do you think it would be worth my time to go through about 100 php files and update the existing mysql functions to reflect the newer mysqli? Or is it a waste of time and should I just be happy with my current mysql extension configuration and continue using that. (From what I am reading, you 'shouldn't' have both mysql and mysqli extensions uncommented in php.ini).
Thought I would hear some thoughts. Thanks for your guidance.
Worth updating my scripts to use mysqli?
Moderator: General Moderators
- seodevhead
- Forum Regular
- Posts: 705
- Joined: Sat Oct 08, 2005 8:18 pm
- Location: Windermere, FL
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I would say time is better spent elsewhere, but if you think updating is important.. I would switch away from calling the functionality directly, shifting toward an encapsulated interaction via a class or even set of user-defined functions. Either way, further alterations will often become easier as there would only be this one central location to change for many things.
- seodevhead
- Forum Regular
- Posts: 705
- Joined: Sat Oct 08, 2005 8:18 pm
- Location: Windermere, FL
Thanks for the advice feyd. So you are suggesting making any mysql function (ex. mysql(i)_query()) a part of a class that is external to all my scripts... so that anytime I need to update a mysql function, I only have to change one file... correct?
Even with that being duly noted... should I continue creating applications using the mysql extension (as opposed to mysqli)? I've been looking in the php manuals and don't see anything about it being deprecated.. am I right?
Even with that being duly noted... should I continue creating applications using the mysql extension (as opposed to mysqli)? I've been looking in the php manuals and don't see anything about it being deprecated.. am I right?
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
MySQLi is a different way of producing the same general connection. It, internally, has a more up to day, by default, library to interface with MySQL with.. however updating the library the original API uses to the newer version provided by MySQL almost entirely nullifies the differences.
There are a few features MySQLi supports over the MySQL extension such as a multiple query function.
There are a few features MySQLi supports over the MySQL extension such as a multiple query function.
- seodevhead
- Forum Regular
- Posts: 705
- Joined: Sat Oct 08, 2005 8:18 pm
- Location: Windermere, FL
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
http://dev.mysql.com/downloads/connector/php/
The old library can be updated to work with the new connection requirements for MySQL 5.
The old library can be updated to work with the new connection requirements for MySQL 5.
- seodevhead
- Forum Regular
- Posts: 705
- Joined: Sat Oct 08, 2005 8:18 pm
- Location: Windermere, FL