Welcome Guest, Not a member yet? Register   Sign In
Undefined property CI_DB_mysql errors
#1

[eluser]2think[/eluser]
Hi everyone.

I've been trying to simply load a database - no session stuff, no queries, just set it in autoload.php under libraries.

I keep getting the following errors:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_DB_mysql_driver::$char_set

Filename: database/DB_driver.php

Line Number: 198

A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_DB_mysql_driver::$dbcollat

Filename: database/DB_driver.php

Line Number: 198

Can someone point me in the right direction to look or give me a fix (and cause?)

Thanks.
#2

[eluser]gtech[/eluser]
hummm line 198 looks different in my code (its a comment) what version are you running?

anyway your error looks like your application/config/database.php is missing the dbcollat variable

$active_group = "default";
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "<my username>";
$db['default']['password'] = "<my password>";
$db['default']['database'] = "<my database>";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = FALSE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

note the last line sets the variable up.
#3

[eluser]2think[/eluser]
Gtech, thanks for the attempt but it's still throwing errors with your correction.

Here's a copy/paste of my application/config/database.php (partial)

| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the "default" group).
|
*/

$active_group = "default";

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "myusername";
$db['default']['password'] = "mypassword";
$db['default']['database'] = "mydatabase";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = “utf8”;
$db['default']['dbcollat'] = “utf8_general_ci”;


?&gt;
#4

[eluser]gtech[/eluser]
well I commented the last two lines out of my config


//$db[’default’][’char_set’] = “utf8”;
//$db[’default’][’dbcollat’] = “utf8_general_ci”;

and got the following errors when I refreshed my app
[code]
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_DB_mysql_driver::$char_set
Filename: database/DB_driver.php
Line Number: 175
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_DB_mysql_driver::$dbcollat
Filename: database/DB_driver.php
Line Number: 175
[code]
looks remarkably similar to what you are seeing... only my line numbers are different.

which version of CodeIgniter are you using, I am using 1.6.1 so I can't understand why your db_driver file is different to mine unless you are pulling your code from SVN?
could you possibly be using the wrong config file (an older one maybe)?
have you tried setting the log_threshold in the config/config.php file to log errors to see if you can get any clues on startup?
#5

[eluser]2think[/eluser]
Ok Gtech, will do, thanks. What I did notice is somehow I had the database.php file missing from my code-igniter/system/libraries/<nodatabase.php>.

I've copied it into there and now there aren't any errors, my entire page is now blank! LOL! No errors, nothing.

I'll keep working at it, I know it has to be some stupidity on my part.

Thanks again
#6

[eluser]gtech[/eluser]
does this link help
[url="http://ellislab.com/forums/viewthread/70601/"]http://ellislab.com/forums/viewthread/70601/[/url]
[url="http://ellislab.com/forums/viewthread/70853/"]http://ellislab.com/forums/viewthread/70853/[/url]

I don't have a database.php in my system\libraries directory



If I was in your situation I would try downloading a fresh install of 1.6.1 from the CI home page and copy it in a different location to your existing code base.

Change the config/database.php and config/config.php in the new codebase to work on your machine.

write a simple controller echoing helloworld, and test it.

then try autoloading the database in autoload.php
#7

[eluser]gtech[/eluser]
forgot to say ... good luck, looks like if you got the error on line 198, you might be using CI 1.6.0? just a guess. edited reply above
#8

[eluser]2think[/eluser]
Thanks for all the help. I am running 1.6.0 and updating my CI files now. I'll post in here for others if I get this thing to work.




Theme © iAndrew 2016 - Forum software by © MyBB