I have a database have 20 tables i want to search all of these i got stuck that how can i search this and solve this query help is very appreciated.
and so one. this is my script.
$condition = '';
//$query = explode(" ", $_GET["search"]);
$query = explode(" ", $_GET["search"]);
foreach($query as $text)
$condition .= "`title` LIKE +'%".mysqli_real_escape_string($connect, $text)."%' OR ";
$condition = substr($condition, 0, -4);
$sql_query = "SELECT * FROM countries2 WHERE " . $condition;
$result = mysqli_query($connect, $sql_query);
if(mysqli_num_rows($result) > 0)
while($row = mysqli_fetch_array($result))
echo '<label>Data not Found</label>';
Try with this
sql_query = "SELECT * FROM `countries`,`countries2` WHERE " . $condition;
i have noticed that you are making a search directory or something like this.
you may use
FULLTEXT SEARCH with operators and
after this your query will look like this.
implement as per your requirement ;).
(SELECT * FROM table1 WHERE(col1,col2,clo3) AGAINST(."$search".) IN NATURAL LANGUAGE MODE)