MySQL Forums
Forum List  »  Newbie

Re: Fatal error: Call to undefined function mysql_connect()
Posted by: Jonathan Stephens
Date: October 24, 2004 09:53PM

Maris,

Are you trying to use ext/mysql or ext/mysqli? mysql_connect() does not exist in mysqli. mysqli is a completely new API with different function names than the mysql extension, you're aware of this, right?

For mysqli, the proper way to initiate a MySQL connection is to use one of:

$link = mysqli_init();
mysqli_real_connect($link, $host, $user, $pass, $db);

or

$link = mysqli_connect($host, $user, $pass);

or

$link = new mysqli($host, $user, $pass, $db);

(I prefer the last one.)

In any case, you must have one of the lines

;extension=php_mysql.dll
;extension=php_mysqli.dll

uncommented in your php.ini file (by removing the leading semicolon), depending on which library you want to use. (Looks like you've got this part figured out.)

Then you should copy either libmysql.dll or libmysqli.dll from your PHP installation directory (usually C:\php on a windows system) to your system directory, depending on which MySQL library you want to use. On Windows 2000 this would be the C:\WINNT\system32 directory.

Restart Apache and check the output of phpinfo(). Under Configuration, you should see a table labeled "mysql" or "mysqli".

Options: ReplyQuote


Subject
Written By
Posted
Re: Fatal error: Call to undefined function mysql_connect()
October 24, 2004 09:53PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.