Welcome Guest, Not a member yet? Register   Sign In
Help with CI active record and like statement
#4

[eluser]CroNiX[/eluser]
[quote author="Aken" date="1252656094"]You can put LOWER(name) in place of your table name and it should generate just like the example you added. Oh, and FYI - in your code example, you have 'after' selected in your third parameter of the like() function. This will generate 'some_var%'. If you want to search both ways, you can omit the third param, or change it to 'both'.

Code:
$search_name = 'search_name';

$this->db->select('name')
    ->like('LOWER(name)', $search_name)
    ->get('users');

// GENERATES: SELECT `name` FROM (`users`) WHERE LOWER(name) LIKE '%search_name%'
[/quote]
Yes, Im using 'after' because its for an autocompleter. Thanks for the info, I swear I tried that like statement you posted...maybe I did something else wrong but its working now.


Messages In This Thread
Help with CI active record and like statement - by El Forum - 09-10-2009, 02:15 PM
Help with CI active record and like statement - by El Forum - 09-10-2009, 08:07 PM
Help with CI active record and like statement - by El Forum - 09-10-2009, 09:01 PM
Help with CI active record and like statement - by El Forum - 09-10-2009, 10:10 PM
Help with CI active record and like statement - by El Forum - 09-10-2009, 10:12 PM
Help with CI active record and like statement - by El Forum - 09-11-2009, 05:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB