Welcome Guest, Not a member yet? Register   Sign In
Database error after upgrading to CI 1.7
#1

[eluser]KeyStroke[/eluser]
Hi,

I'm having a problem here after upgrading CodeIgniter from 1.6.3 to 1.7.0 . The application doesn't detect my databases anymore. I keep getting this error:

Quote:A Database Error Occurred

Error Number: 1146

Table 'database1.user' doesn't exist

What could be wrong? I've followed the instructions carefully, and all my database settings are correct.


Your help is much appreciated.
#2

[eluser]KeyStroke[/eluser]
I just removed the 1.7 files from "system/database" and replaced them with the 1.6.3 files and my application works again.

What's the problem with the 1.7.0 database files?
#3

[eluser]Sergi Ortega [TEAMVALLES][/eluser]
Hello,

I had the same problem two days ago when actualized CI to 1.7.X

DB Class in CI 1.6.X (Active Record) don't escape automatically queries.

Example:

Code:
$this->db->select("*,DATE_FORMAT(created,'%d-%m-%Y %h:%m:%s') as created_format")->from("foo");
This works well in 1.6.X but NOT in 1.7.X !!

The problem is that CI 1.7.X automatically escapes strange chars for preventing SQL Injection such as ( and ' and %.
CI 1.7.X now has a second parameter in SELECT method (ESCAPE OR NOT / TRUE, FALSE), by default TRUE.

So in CI 1.7.X the same query is like this:

Code:
$this->db->select("*,DATE_FORMAT(created,'%d-%m-%Y %h:%m:%s',FALSE) as created_format")->from("foo");
See second parameter (,FALSE) in SELECT method

In 1.7.X if you're programming basic queries like:

Code:
$this->db->select("*")->from("foo");

Second parameter (ESCAPE OR NOT) don't to be passed due Select query * don't need to be escaped because haven't any strange injection chars.

Good Luck!
#4

[eluser]KeyStroke[/eluser]
Thanks for your response, but how is this related to my problem? As you can see, my problem is that CodeIgniter doesn't even find my tables in the first place, so it can't run my queries on them.
#5

[eluser]Sergi Ortega [TEAMVALLES][/eluser]
Hi again!

Try it!

I was getting mad by the problem (the same problem you have (don't find the tables!!))

Finally I fix this issue explained in my last post and It works ;-)

May be isn't your problem by It works for me.

BTW, See your BBDD config file in CI and check that all is ok!

Regards & GL.




Theme © iAndrew 2016 - Forum software by © MyBB