Welcome Guest, Not a member yet? Register   Sign In
Upgrading CI generates error
#1

[eluser]Computerzworld[/eluser]
Hello,
I have tried to upgrade my old CI version 1.6.1 to 1.7.1. All the things run fine except database. If I replace older database folder(1.6.1) to new database folder(1.7.1) it is giving error in all queries. Every query gets false. Is there any other modification that I have to do in order to get it work along with database? Please help me. Thanks in advance.
#2

[eluser]TheFuzzy0ne[/eluser]
Can you give us an example of a query that's causing an error? The syntax is different in some places, but you should easily be able to troubleshoot the query.
#3

[eluser]Computerzworld[/eluser]
Here is my query...
Code:
$this->db->select('*');
$this->db->from('tbl_users');
$this->db->where("levelId!=1");
$this->db->where("isDeleted",'0');
$this->db->orderby("firstName,lastName");

And I am getting error like unknown column levelId in the query even if the column exists in table and the same query works inside version 1.6.1 and it gives error in version 1.7.1.
#4

[eluser]TheFuzzy0ne[/eluser]
Is it too late to change your database schema so that all field names are lowercase, and you substitute spaces for underscores? I'm not totally sure if this will fix your problem, but I do know it's considered good practice to label your database in this fashion. You could just replicate your users table, and rename the fields on that table, and then try the same query on the new table to see if it makes any difference.

Also, I noticed your table prefix is 'tbl_' I was wondering if this is really necessary, since it's quite obvious it's a table.
#5

[eluser]wiredesignz[/eluser]
CI 1.7.1 may be back ticking this entire string "levelId!=1" causing the error, try adding a few spaces like so "levelId != 1"
#6

[eluser]Computerzworld[/eluser]
Also I am getting extra quotation in every query in where condition. So every query gets false. And also there is no problem of false query as it works perfectly with my older version.
#7

[eluser]cpp643[/eluser]
My Dear Friend, i think you have some other problem, because if CI have new version then it also have support to older syntex.if this is not then CI doesn't follow the standards.because if M/S has made Office 2003 then Office 2000's file also opened in new version.
#8

[eluser]Dam1an[/eluser]
Why are you using single quotes for some items and double for others?

Also, the where clause should be split over 2 parts, should it not?
Code:
$this->db->where('levelId !=', 1);
#9

[eluser]TheFuzzy0ne[/eluser]
[quote author="cpp643" date="1243446331"]My Dear Friend, i think you have some other problem, because if CI have new version then it also have support to older syntex.if this is not then CI doesn't follow the standards.because if M/S has made Office 2003 then Office 2000's file also opened in new version.[/quote]

Actually, that's not strictly true. CodeIgniter is not fully backwards compatible. Some changes were made to the Active Record class, and in order to make it more functional code has been rewritten, and some method parameters have been changed slightly.

I agree with what wiredesignz said, however. It never occurred to be before, but the more I think about it the more it makes sense.
#10

[eluser]Computerzworld[/eluser]
@TheFuzzy0ne

So.. the code written in older version doesn't works with newer one? That should not be the case... Because just upgrading system files should not effect my existing code.




Theme © iAndrew 2016 - Forum software by © MyBB