![]() |
DB Active Record Class: Combining of where and like statements - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: DB Active Record Class: Combining of where and like statements (/showthread.php?tid=3301) |
DB Active Record Class: Combining of where and like statements - El Forum - 09-23-2007 [eluser]mb2007[/eluser] Hello, I would like to combine where and like statements with the active record class. So I tried: Code: $this->db->where('status', 'angenommen'); Code: WHERE STATUS = 'angenommen' Code: WHERE status = 'angenommen' Is there a way to influence the sequence of the statements? Matthias. DB Active Record Class: Combining of where and like statements - El Forum - 05-11-2009 [eluser]B3ll4triX[/eluser] http://ellislab.com/forums/viewthread/45307/ :lol: DB Active Record Class: Combining of where and like statements - El Forum - 05-11-2009 [eluser]kgill[/eluser] Way to go! Where were you two years ago when he needed your help... Heh look at the date of his post. ![]() DB Active Record Class: Combining of where and like statements - El Forum - 05-11-2009 [eluser]B3ll4triX[/eluser] ya... I do not see a date... :cheese: DB Active Record Class: Combining of where and like statements - El Forum - 08-10-2011 [eluser]Unknown[/eluser] lol ![]() DB Active Record Class: Combining of where and like statements - El Forum - 02-03-2012 [eluser]Rai Ehtisham[/eluser] i have the same problem please help DB Active Record Class: Combining of where and like statements - El Forum - 02-03-2012 [eluser]leela[/eluser] If you want to write complex query. Its better if you write the whole query.. Codeigniter active database supports actively for the smaller queries with simpler conditions. it doesn't supports for the complex query and the multiple nested conditions in the query. I would prefer to write the query rather than using the codeigniter helper DB Active Record Class: Combining of where and like statements - El Forum - 02-03-2012 [eluser]Rai Ehtisham[/eluser] Thanks for the reply. I am using pagination to display results from a complex query which contains one WHERE and 6 OR LIKE conditions. The query works fine if written manually but when written with CI functions like $this->db->where(); or $this->db->like/or_like it displays results from all rows instead of fetching only the where clause records. I am doing a huge project and i am stuck at this point. When i write a custom query and pass the pagination $num and $offset it gives me an error on the first offset because the first page offset is always 0. It works fine with the CI db functions though. Please give me an example code if anyone here have it. Give me a search results paginated code. I need it on this weekend. Help PLZ DB Active Record Class: Combining of where and like statements - El Forum - 02-03-2012 [eluser]CroNiX[/eluser] Don't waste time trying to get complex queries to work in active record. Just use db::query(); I believe there are improvements coming to CI3 that will let you do subqueries and complex like statements, but that doesn't help you here right now. Code: $blah = $this->db->escape($this->input->post('blah')); //manually escape all input DB Active Record Class: Combining of where and like statements - El Forum - 02-03-2012 [eluser]Rai Ehtisham[/eluser] Thanks for the help but i need a search result pagination example. A good one and a standard one which includes WHERE and LIKE both Please put in a good one |