Welcome Guest, Not a member yet? Register   Sign In
DB Problem with CI 2.1.1
#1

[eluser]cmh24[/eluser]
Hi everybody,

just upgraded to CI 2.1.1 (like described in the userguide).

Now I have the following problem with my database. I want to get all users who uploaded a photo. That means it is not empty.

Code:
$data['users'] = $this->db->where('user_photo !=', '')->get('users')->result();

But it does not work. With CI 2.1 it worked. Now I get an error message.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`!=` ''' at line 3

SELECT * FROM (`users`) WHERE `user_photo` `!=` ''

What changed?

Looking forward to any help.

Best regards!
Max
#2

[eluser]Otemu[/eluser]
Try this

Controller:
Code:
$data['users']= $this->Users->getPhotos();


Model:
Code:
function getPhotos(()
    {
  $this->db->where('name !=', '');
  $query = $this->db->get('users');
  return $query->result();
    }
#3

[eluser]Linh Pham[/eluser]
[quote author="cmh24" date="1339578125"]Hi everybody,

just upgraded to CI 2.1.1 (like described in the userguide).

Now I have the following problem with my database. I want to get all users who uploaded a photo. That means it is not empty.

Code:
$data['users'] = $this->db->where('user_photo !=', '')->get('users')->result();

But it does not work. With CI 2.1 it worked. Now I get an error message.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`!=` ''' at line 3

SELECT * FROM (`users`) WHERE `user_photo` `!=` ''

What changed?

Looking forward to any help.

Best regards!
Max[/quote]

I am also getting this problem, who can i help you, please!
#4

[eluser]moodh[/eluser]
Got the same problem as well.
$this->db->where('start < ', time());
$this->db->where('end > ', time());
Gives me protect identifier errors, adding a FALSE to the third argument works. But seriously, I do not want to go through thousands of files to fix all these occurances. Stop breaking the framework when releasing a minor version, please. Sad
#5

[eluser]Unknown[/eluser]
[quote author="narcisha" date="1339594959"]Got the same problem as well.
$this->db->where('start < ', time());
$this->db->where('end > ', time());
Gives me protect identifier errors, adding a FALSE to the third argument works. But seriously, I do not want to go through thousands of files to fix all these occurances. Stop breaking the framework when releasing a minor version, please. Sad[/quote]

i had same problem to.
and then i use /system/database/drivers/db_drivers.php from 2.1.0, problem solved,

it seems it related to
https://github.com/EllisLab/CodeIgniter/issues/1469

i hope they will fix it soon
#6

[eluser]srpurdy[/eluser]
Same issue here. Why is it twice now minor releases break entire systems. It's completely crazy coding practices.
Code:
$query = $this->db
->where('')
->select('')
->from('table1,table2')
->join('table1', 'table1.id = table2.id')
->order_by('table1.sort_id', 'asc')
->get();
return $query;

Seem as though this version doesn't like ->get();

This query no longer works. 90% of my queries are written this way.. I guess I go back to 2.1.0...
#7

[eluser]mcryan[/eluser]
I'm having the same problem. A lot of my queries are now broken, have to go back to 2.1.0. Even CI's session class is giving me problems:

Code:
DELETE FROM `ci_sessions` WHERE `last_activity` `< 1339662429`
#8

[eluser]Phil Sturgeon[/eluser]
Related issues:

https://github.com/EllisLab/CodeIgniter/issues/1469
https://github.com/EllisLab/CodeIgniter/issues/1471
#9

[eluser]mcryan[/eluser]
Thanks Phil. Well download the update and give it a test.




Theme © iAndrew 2016 - Forum software by © MyBB