Welcome Guest, Not a member yet? Register   Sign In
Can't connect to MySQL, when not on local server
#1

[eluser]KnMn[/eluser]
I have a small app that works perfectly on my home testing server.

When I upload it to my webhost, I start getting an "Unable to connect to your database server using the provided settings" error.

Obviously I've reconfigured my application/config/database.php to have my new credentials in it, and just to make sure I wasn't accidentally using a wrong password or something, I created a test.php file which simply tried to mysql_connect to the server, and it worked.

Anyone care to hazard a guess at whats wrong?
#2

[eluser]TheFuzzy0ne[/eluser]
I would have thought it still has something to do with your settings. If you can connect to it with mysql_connect(), then CodeIgniter should also be able to, as it too uses mysql_connect(). If it's not connecting, then it must be incorrect information, be it a username, password, database name etc...

I would strongly urge you to check, double-check and triple-check your configuration again.
#3

[eluser]KnMn[/eluser]
I have. I checked it a lot of times.

After searching the forums, I read about people getting the same error and it being solved by getting codeigniter from the SVN. I tried this, and it didn't fix it.

Then on a whim, I typed "mysqli" instead of "mysql" and it worked.

I know nothing about mysqli. Have I been an idiot?
#4

[eluser]TheFuzzy0ne[/eluser]
It depends. Do you use active record? MySQLi is virtually identical to the MySQL extension, the main difference is that MySQLi has been geared more towards OOP, whereas the MySQL extension is procedural. They essentially do the same thing, and you should ideally use them through CodeIgniter's database abstraction layer.

In theory, if you use the CodeIgniter's database abstraction layer, and no proprietary SQL statements, your application should work no matter what kind of database engine is running under the hood.




Theme © iAndrew 2016 - Forum software by © MyBB