Is it possible to search a string in table without specifing column?
$string = 'hello';
$sql = mysql_query("SELECT * FROM table WHERE all_columns LIKE '%,$string,%' ");
and i would like to get one response p.e if there would be two columns in one row which containts same or similar content, but this is not important, i can handle it.
// MY IDEA, NOT SO FAST BUT MIGHT WORK
$sql = mysql_query("SELECT * FROM particular_table LIMIT = 1");
$data = mysql_fetch_array($sql);
$limit = count($data);
$where_condition = 'WHERE published = 1 AND (';
$index = 1;
foreach($data as $key=>$val){
if($index==$limit){
$where_condition .= ' '.$key.' LIKE %,'.$string.',%';
} else {
$where_condition .= ' '.$key.' LIKE %,'.$string.',% OR';
}
$index++;
}
$where_condition .= ')';
$get = mysql_query("SELECT * FROM particular_table $where_condition");
$res = mysql_fetch_array($get);
It can be stupid and unnecessary so give me your opintion please