 |
BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
 | This is the forum to discuss the Wrox book Professional CodeIgniter by Thomas Myer; ISBN: 9780470282458 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

September 7th, 2012, 12:20 AM
|
Registered User
|
|
Join Date: Dec 2011
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
How can I use operators(!=, < , > etc) for checking
Dear Sir,
I tried to use operators(!=, < , > etc) for finding data from database using this query
"SELECT `id`, `name`, `thumbnail`, `category_id` FROM (`products`) WHERE `status` = 'active' AND `id` `!=` '6' ORDER BY `category_id` desc LIMIT 100", but found error message.
Can you please suggest me how can I fix this problem ?
Thanks
Jobayer
|

September 9th, 2012, 07:29 AM
|
Registered User
|
|
Join Date: Sep 2012
Posts: 9
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
What's the error you get from the DB?
|

September 10th, 2012, 11:02 AM
|
Registered User
|
|
Join Date: Dec 2011
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
|
|
It shows "Error Number: 1064
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 '`!=` '6' ORDER BY `category_id` desc LIMIT 100' at line 4
SELECT `id`, `name`, `thumbnail`, `category_id` FROM (`products`) WHERE `status` = 'active' AND `id` `!=` '6' ORDER BY `category_id` desc LIMIT 100".
Thanks in Advance
Jobayer
|

September 10th, 2012, 11:15 AM
|
Registered User
|
|
Join Date: Sep 2012
Posts: 9
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Try this
Code:
SELECT `id`, `name`, `thumbnail`, `category_id` FROM (`products`) WHERE `status` = 'active' AND `id` != '6' ORDER BY `category_id` desc LIMIT 100
|

September 11th, 2012, 07:13 AM
|
Friend of Wrox
|
|
Join Date: May 2011
Posts: 125
Thanks: 0
Thanked 24 Times in 24 Posts
|
|
Greetings,
You're missing the point in the topic I mentioned above the OP says this;
Quote:
Originally Posted by jobayer_34
Dear Sir,
Thanks for your message. I have used db->where('id !=', '6') then it produces this query. Can you please suggest me how can I use operators for checking (I want to check where id!=6)?
Thanks in advance
Jobayer
|
so he's using the class method 'where' to generate the WHERE clause BUT it's wrapping the != in back ticks/quotes so it's generating an error when the sql is executed.
|

September 11th, 2012, 07:45 AM
|
Registered User
|
|
Join Date: Sep 2012
Posts: 9
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Quote:
Originally Posted by UseLess
Greetings,
You're missing the point in the topic I mentioned above the OP says this;
so he's using the class method 'where' to generate the WHERE clause BUT it's wrapping the != in back ticks/quotes so it's generating an error when the sql is executed.
|
Yep, I missed that other post ...
I responded there. NOT EQUAL operators are either != or <>
|
|
 |