You are here: Re: [PHP] Call to undefined function mysql_real_escape_string()] « PHP « IT news, forums, messages
Re: [PHP] Call to undefined function mysql_real_escape_string()]

Posted by Curt Zirzow on 12/09/05 07:08

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация