⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

select table with condition



beimar24
  • profile picture
  • Member

Posted 06 June 2013 - 05:11 AM

Good day valued engineers
I have the following need to display a table Disadvantage
but only those who are active

in this table I have a field called state
ahy keep active or inactive
I need to show only the people who are in active state

someone has an idea how I can do

in advance thank you very much for your help

 

Cordialmente

Beimar

desde Villavicencio Colombia

 

 


davidoster
  • profile picture
  • Member

Posted 06 June 2013 - 11:51 AM

Hello.

Just use the where function.


beimar24
  • profile picture
  • Member

Posted 06 June 2013 - 20:09 PM

my dear friend, I worked

I have people at the table status field
 
1 active
2 Off
 
and I need to show only people with the active state = 1
 
$ crud-> where ('status', 1);
$ crud-> set_table ('people')
-> $ crud-> order_by ('Document')
$ crud-> change_field_type ('State', 'hidden', '1 ');
 
But it does not work, I get this error
 
 
A PHP Error was Encountered
 
Severity: 4096
 
Message: Object of class grocery_CRUD Could not be converted to string
 
Filename: controllers / personas.php
 
Line Number: 194
 
 
in advance thank you very much for your collaboration

davidoster
  • profile picture
  • Member

Posted 09 June 2013 - 04:32 AM

What values are stored on the database?

1,2 or active, off?

Try to put the value to single quotes, like this $crud->where('status', '1'); or $crud->where('status', 'active');


beimar24
  • profile picture
  • Member

Posted 10 June 2013 - 16:04 PM

very nice dear engineer
I worked thank you very much
God bless

 

where ('table.field,'1 ');


JpunkLy
  • profile picture
  • Member

Posted 17 June 2013 - 19:44 PM

Nice...!! :D