Quick Problem

Hi, I tried the following in a .php file:

PHP Testing <?php $mysqli = mysqli("localhost", "localuser", "localpass", "database"); if (mysqli_connect_errno()) { printf("Connect failed: %sn", mysqli_connect_error()); exit(); } else { printf("Host information: %sn", mysqli_get_host_info($mysqli)); } ?>

When I access the file’s site, it is blank and I see nothing. What must I do to fix this error and what causes it? I have looked all over.

Try error_reporting(E_ALL); and see what the screen returns then.

I tried your code but unfortunately it still showed up blank. :cry:

It has to do with mysqli, something about the installation I must not be understanding properly. I mean, in php.ini I changed the extension from ;extension=php_mysqli.dll to extension=php_mysqli.dll, so shouldn’t it work?

what versions of sql and php are you running?

I am using MySQL 5.0 with PHP 5.2.1 and Apache HTTP Server 2.2.4.

did you try


to see if everything is installed ok?

Yep. It works fine. I even did a few functions with variables, and all that worked great. The problem seems to be with mysqli or something. Any ideas?

mysqli = e:mysql

is this or something like it in your php.ini?

I could not find anything like that there.

Sounds like mysqli is not installed on your system, or perhaps PHP can’t find it. Is the mysqli service running?

I don’t think mysqli is the same as mysql, but someone correct me if I’m wrong.

No, mysqli is something different, I know when I installed WAMP on my development server, I noticed that if I wanted to use mysqli I had to turn on a special extention for that. So no they are not the same.

Installation on Windows Systems

MySQLi is not enabled by default, so the php_mysqli.dll DLL must be enabled inside of php.ini. Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH. See the FAQ titled “How do I add my PHP directory to the PATH on Windows” for information on how to do this. Although copying libmysql.dll to the Windows system directory also works (because the system directory is by default in the system’s PATH), it’s not recommended.

This was found here http://www.php.net/mysqli

Sponsor our Newsletter | Privacy Policy | Terms of Service