Mysqli support - test or complain?



PHP List,

Based on what seemed to be good advice to switch to using mysqli for interacting with a MySQL database, I built a content management system that uses mysqli for all it's calls.

It works great on a lot of my servers. However, I just discovered that one web hosting service I use does not have mysqli enabled. I ran the phpinfo() command and they are running 5.2.5, but the configure command does not contain "--with-mysqli".

I would like the scripts I've written to be somewhat portable, but I'm unsure of whether or not I should assume that mysqli is in use.

I see it as being a situation of essentially two options.

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?

Thank you for any advice or assistance.

--
Dave M G
.



Relevant Pages

  • Re: [PHP] Mysqli support - test or complain?
    ... In this case I should write my scripts to test whether it exists and then use either mysqli or straight mysql commands as appropriate. ... 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. ...
    (php.general)
  • Re: [PHP] Mysqli issue
    ... record in a mysql database using mysqli ... I was looking at my MySQL not MySQLi stuff, ... '$var' definitely should have been $var since you want the contents, but according to the php site, the prepare is for the query, so my guess is you'll want the query put in the line instead of what looks to be the pieces of the insert? ... 'SELECT District FROM City WHERE Name=?') ...
    (php.general)
  • Re: [PHP] Is this the best way?
    ... The info is stored in a MySQL database, and I am using mysqli ... One thing I would suggest is that you make username unique in your database if you want to avoid duplicate results. ... Jason Pruim ...
    (php.general)
  • Re: [PHP] Mysqli support - test or complain?
    ... scripts to test whether it exists and then use either mysqli or ... do I do to test for the existence of mysqli from within a PHP script? ... not provide it, simply chose another provider. ... install it, or I find a different host. ...
    (php.general)