[ SOLVED ] SQL Like Handling (Active Record class) |
[eluser]tkaw220[/eluser]
Thanks ci user. Guest I wish to learn more about CI. Thanks.
[eluser]tkaw220[/eluser]
[quote author="ci user" date="1307379921"]I guess i could not work it by active record method. Please try this.. $query = $this->db->where('(publish !=\'no\')')->or_like($data)->order_by('brand, format, title', 'asc')->get('products'); Thanks, ci user.[/quote] This code is same as mine in the first post.
[eluser]theprodigy[/eluser]
Quote:This code is same as mine in the first post. Code: $query = $this->db->where(’(publish !=\‘no\’)’)->or_like($data)->order_by(‘brand, format, title’, ‘asc’)->get(‘products’); Yours did not have these parenthesis hard coded.
[eluser]tkaw220[/eluser]
[quote author="theprodigy" date="1307431764"] Quote:This code is same as mine in the first post. Code: $query = $this->db->where(’(publish !=\‘no\’)’)->or_like($data)->order_by(‘brand, format, title’, ‘asc’)->get(‘products’); Yours did not have these parenthesis hard coded.[/quote] Hi theprodigy and ci user: @theprodigy: Thanks for pointing out the difference. @ci user: I cannot thank you enough for the inspiration from your 'WHERE' clause. I did not notice that I can use it like this. Your code inspired me to come out with below code, which I think it is cleaner, and it works the way I want it: Code: $query = $this->db var_dump: Code: 'SELECT * I hope the above finding may benefit other CI users. Please update me if there is other better and cleaner way to to this. Thanks and have a nice day. Regards, Edwin
[eluser]plain jane[/eluser]
tkaw220, Thanks for your solution it helped me. Have a nice day. Thanks, ci user
[eluser]tkaw220[/eluser]
Hi ci user, Not at all. The code is not possible without your help. I have another issue with URL, would appreciate if you could help me. Let said I have a controller named new_product, and my subsequence URL might look like this: Code: http://www.domain.com/index.php/new_product/disney_book OR I would like to make the URL search engine friendly where underscore replaced with dash like this: Code: http://www.domain.com/index.php/new-product/disney-book OR I aware of CI url_title() function but do not know how and where to implement it to turn my URL human friendly. Huge thanks to you in advanced.
[eluser]plain jane[/eluser]
Thank you for appreciation. I have not worked in url rewriting and sorry for that. But here is an article you may find helpful. Quote:http://stackoverflow.com/questions/21050...ith-hyphen Thanks, ci user
[eluser]tkaw220[/eluser]
[quote author="ci user" date="1307448844"]Thank you for appreciation. I have not worked in url rewriting and sorry for that. But here is an article you may find helpful. Quote:http://stackoverflow.com/questions/21050...ith-hyphen Thanks, ci user[/quote] It is OK. Thanks for the finding. Have a nice day.
[eluser]plain jane[/eluser]
Remove the index.php from your URLs to make them SEO friendly. Thanks, ci user
[eluser]tkaw220[/eluser]
[quote author="ci user" date="1307449511"]Remove the index.php from your URLs to make them SEO friendly. Thanks, ci user[/quote] Will do that, thanks for the mentioned. |
Welcome Guest, Not a member yet? Register Sign In |