On Thu, Dec 08, 2005 at 08:32:56AM -0500, Paul Hickey wrote:
> I have PHP compiled with mysqli.
> 
> The standard answer from the Joomla forums is that I need to have
> "mysql" vice "mysqli". I was looking for a more global solution than
> having to modify the code for every component, module, mambot I want to
> use.

Well there is a rather global solution, but will require some work.
You would have to create a wrapper for all mysql* calls to use
mysqli, so for example:

<?php
if( !function_exists('mysql_connect') &&
    function_exists('mysqli_real_connect') ) {

  function mysql_connect($server, $username, $password) {
    gobal $_mysql_mysqli_dbh_;
    $_mysql_mysqli_dbh_ = mysqli_init();
    
    return mysqli_real_connect($_mysql_mysqli_dbh_, $server, $username, 
$password);
  }

  function mysql_real_escape_string($string, $dbh=false) {

    if($dbh === $false) {
      gobal $_mysql_mysqli_dbh_;
      $dbh = $_mysql_mysqli_dbh_;
    }

    return mysqli_real_escape_string($dbh, $string);
  }
  // any other interface needed.

}
?>


I've been meaning to write something like this for the
Pear::PHP_Compat tool, it could help upgrading all your scripts to
mysqli interface, not to mention upgrading to php5.1


Curt.
-- 
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to