I have added search option to a project. There I used jquery auto complete feature to display related result for the keyword when some particular user is entering in search text box.
this is my php script..
<?php
require_once('database.php');
if(isset($_POST['queryString'])) {
$queryString = $dbc->real_escape_string($_POST['queryString']);
if(strlen($queryString) >0) {
//$query = $dbc->query("SELECT subjects FROM subject WHERE subjects LIKE '$queryString%' LIMIT 10");
$q = "SELECT tutor_name FROM tutors WHERE tutor_name LIKE '%$queryString%' LIMIT 10";
$r = mysqli_query ( $dbc, $q);
if($q) {
while ($row = mysqli_fetch_array($r, MYSQL_ASSOC)) {
echo '<li onClick="fill(\''.$row['tutor_name'].'\');">'.$row['tutor_name'].'</li>';
}
} else {
echo 'ERROR: There was a problem with the query.';
}
} else {
}
} else {
echo 'There should be no direct access to this script!';
}
?>
This is working properly for me.. but my problem is I need to check multiple tables with typing keyword. Here I use only one table.. anyone can tell me how can I attach my other tables to this query?