CodeIgniter Forums
MySQLi Connection error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: MySQLi Connection error (/showthread.php?tid=12635)



MySQLi Connection error - El Forum - 10-26-2008

[eluser]Atasa[/eluser]
Hello everyone,
I was very happy to see all these changes and progress to ci with version 1.7,
especially to the Validation class.
Please someone can confirm this...
There is an error coming out saying that Unable to connect to database with the provided settings.
For sure in 1.6.3 I was able to connect therefor I enabled the logs to see what's wrong.

Surprisingly the error was:

Severity: Warning --> mysqli_connect() expects parameter 5 to be long, string given /srv/www/ci/admin/system/database/drivers/mysqli/mysqli_driver.php 63

On line 63 exists the function db_connect(), and I am not using it.
I use the function db_pconnect() beacause I have set it to TRUE in my config file.

Any comment will be appreciated

A.


MySQLi Connection error - El Forum - 10-26-2008

[eluser]Piziwate[/eluser]
Hello Atasa, Hello everybody !

I have exactly the same problem :

Here is my "Test" Db Config

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "";
$db['default']['database'] = "test";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "test_";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

DEBUG - 2008-10-26 17:40:32 --> Database Driver Class Initialized
ERROR - 2008-10-26 17:40:32 --> Severity: Warning --> mysqli_connect() expects parameter 5 to be long, string given E:\Developpement\www\smartnms\system\database\drivers\mysqli\mysqli_driver.php 63
ERROR - 2008-10-26 17:40:32 --> Unable to connect to the database

If I use mysql instead of mysqli, everything is working fine !

Regards

Piziwate


MySQLi Connection error - El Forum - 10-26-2008

[eluser]Randy Casburn[/eluser]
Hi,

Version 1.7.0 added support for a port configuration, but didn't make the configuration optional.

if you add:

$db['default']['port']= '3306';

things should be just fine. I know that might not make sense given the error, but that will fix you.

Hope that helps.

Randy


MySQLi Connection error - El Forum - 10-27-2008

[eluser]Piziwate[/eluser]
Thank you ! it worked for me !

Regards

Piziwate


MySQLi Connection error - El Forum - 10-27-2008

[eluser]Randy Casburn[/eluser]
You're very welcome! And Welcome to CI too!

Randy


MySQLi Connection error - El Forum - 10-27-2008

[eluser]Piziwate[/eluser]
Thank you ! I searched a lot of time a good server side framework to use with ExtJs ! And CI was the best for me !

Regards !

Steve


MySQLi Connection error - El Forum - 10-27-2008

[eluser]Randy Casburn[/eluser]
When I get time I'm going to publish how I've laid out ExtJS and CI together. cu.


MySQLi Connection error - El Forum - 10-30-2008

[eluser]qwertyqwerty[/eluser]
I can confirm that adding $db[‘default’][‘port’]= ‘3306’; does fix the problem!

There are two things that need to be done to fix this bug:
- The class variable $port should have default value of 3306
- $db[‘default’][‘port’]= ‘3306’; should be added to the database.php config file


MySQLi Connection error - El Forum - 10-30-2008

[eluser]Randy Casburn[/eluser]
I've been told that this has been fixed in SVN. So the CI team is taking care us folks.

These guys are great.

Randy