Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old November 8th, 2009, 09:02 AM
Authorized User
 
Join Date: Nov 2009
Posts: 26
Thanks: 3
Thanked 0 Times in 0 Posts
Default search results show inactive status

When I search a product, it shows inactive status product as well.

Even though mproducts/search has where status = active,

Code:
$this->db->where('status','active');
Why does it show inactive product here?
  #2 (permalink)  
Old November 8th, 2009, 10:25 AM
Authorized User
 
Join Date: Nov 2009
Posts: 26
Thanks: 3
Thanked 0 Times in 0 Posts
Wink Change mproducts.php

Code:
$this->db->like('name',db_clean($term));
$this->db->or_like('shortdesc',db_clean($term));
$this->db->or_like('longdesc',db_clean($term));
$this->db->where('status','active');
This produces statements
Quote:
WHERE name LIKE '%$term%' OR shortdesc LIKE '%$term%' OR longdesc LIKE '%$term%' AND status='active'

Change it to the followings.

Code:
$this->db->where("(name LIKE '%$term%' OR shortdesc LIKE '%$term%' OR longdesc LIKE '%$term%') AND status='active'");
Then it fixs the problem.


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show the Active Status Box? karwaabhi ASP.NET 2.0 Professional 0 February 7th, 2007 06:59 AM
show results of SQL in txtbox Loralee Access 3 January 4th, 2007 11:40 AM
Gridview/SqlDataSource won't show results fizzerchris ASP.NET 2.0 Professional 4 September 27th, 2006 02:35 PM
Gridview won't show results fizzerchris ASP.NET 2.0 Basics 0 September 22nd, 2006 06:20 PM
Customize Search Results bmains ASP.NET 1.0 and 1.1 Professional 4 January 15th, 2004 08:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.