Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7495931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:23:41+00:00 2026-05-29T18:23:41+00:00

i have a gridview with search option by a database table.All working fine but

  • 0

i have a gridview with search option by a database table.All working fine but the problem is when i enter a id value to search my grid it shows all the related value rows. For example if i enter value “1” it filters all 1’s like 1,10,11,12,13,….
But i need to show only exact value what i entered it should show only the corresponding row i hope u understand my prob…

my model is like below

public function search()
{
    // Warning: Please modify the following code to remove attributes that
    // should not be searched.

    $criteria=new CDbCriteria(array('order'=>'proc_id DESC'));
    //$criteria->condition = " status = 'Active' ";
    $criteria->compare('proc_id',$this->proc_id);
    $criteria->compare('book_id',$this->book_id,true);return new CActiveDataProvider($this, array(
        'criteria'=>$criteria,
        'pagination'=>array(
        'pageSize'=>50
    ),
    ));
}

hi i found the answer for my problem i just removed true from my code as below

        $criteria->compare('book_id',$this->book_id);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T18:23:48+00:00Added an answer on May 29, 2026 at 6:23 pm

    You can set up any kind of mySql WHERE condition you want like this:

    $criteria->addCondition('proc_id = :procid'); // add your sql WHERE condition
    $criteria->params[':procid'] = $this->proc_id; // bind your parameter
    

    You should be able to use compare() though, but you might have to cast the ID to an integer:

    $criteria->compare('proc_id', (int) $this->proc_id);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview which shows all the information of the data table. I
I have a Gridview that displays paged results from a search query. The problem
I have a gridview that imports data from a remote database, this is working
I have one GridView with Employee search results in it. This GridView shows results
I have a gridview that displays the contents of a database table, using an
I have a GridView inside an UpdatePanel that is populated when a search is
Greetings, In my current project, I have gridview, search button, text box for search,
I have a gridview in which the first column in a checkbox. The grid
I have a GridView containing records from a table which can be deleted or
I have a resultgridview from a search query. In this gridview I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.