Re: Mysqli support - test or complain?

From: Date: Mon, 10 Dec 2007 11:04:15 +0000
Subject: Re: Mysqli support - test or complain?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-265600@lists.php.net to get a copy of this message
One is based on the assumption that mysqli is as likely not to be available as it is to be installed. In this case I should write my scripts to test whether it exists and then use either mysqli or straight mysql commands as appropriate. If this is the way to go, what do I do to test for the existence of mysqli from within a PHP script? The other is to assume that recent installs and upgrades of PHP > 5 should have mysqli because that's the currently preferred way of doing things, and therefore I should contact the web host and ask that they install it, or I find a different host. Which assumption should I be proceeding with?
You can: 1. Change your program to use the much more common mysql extension and forget about mnysqli for the time being (this is what I would do). You can switch to mysqli when its use becomes prevalent. 2. State that mysqli is required and not change anything (not advisable) 3. Alter your program to support both - use mysqi if it's avilable, mysql if it's not. If you use an API and not the mysqli functions directly this won't be too much hassle. Your last option to to assume that it's installed is very bad indeed. You shouldn't ever make assumptions, particularly when your dealing with software distributions. -- Richard Heyes http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support ** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

« previous php.general (#265600) next »