CodeIgniter Forums

Full Version: search from database using text field and search button
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]skhan[/eluser]
Hi! I am newbie here.
i want to create search from database using text field and search button without ajax, javascript or jquery.
i want php using codeigniter framework,

here is my table ('inventory') and my fields are ('id', 'item', 'unitprice', 'qty')

when i search 'an' i want to view all item starts with 'an',

i do login,CRUD, mvc using codeigniter but this one is difficult for me..
someone help me please.

thanks in advance!

El Forum

[eluser]Nisha S.[/eluser]
Do you want to search on all the fields? Then you need to add all the fields with or where clause. Use % at the end since you need to display the results starting with an.

Code:
$searchString = 'an';//get it as parameter
$this->db->like('fieldName',$searchString  . '%');