$sql = "SELECT * FROM tbl_name WHERE ?? LIKE %??%";
ie.
$sql = "SELECT * FROM customer WHERE address LIKE %$search%";
here $search is the variable what you type in the search box.
Note.The above way .. it will only search single word.let say you address fields has this words" Willoughby Road". if you search for just "willoughby" it will show result.but if you search for the whole word " Willoughby Road" you won't get results.
the following method is better.I just got the following code from this forum.Here ur form input varaible is $q.
$search = '';
$the_array = explode(' ', $q);
$i = 0;
foreach( $the_array AS $t ){
if( $i == 0 ){
$search .= " '%$t%' ";
$i = 1;
}else{
$search .= " OR address LIKE '%$t%' ";
}
}
$sqlx= mysql_query("select address from customer where address like $search",$dbi);
........etc....