- Make sure that you are connected the right database
- Check who's the owner of the table and permissions on it.
- Run your SQL directly in the database and see if you get any results.
Change you code to:
$back="<br><br><a href='searchbymake.php'>Back</a>";
////if there is no input enterd by the users///
if(!$make){
echo "No search term given";
echo $back;
exit();
}
//connect to database server and select a database called cars
$conn = mysqli_connect("localhost", "root", "","cars");
$query= "select * from cartable where make like '%".$make."%'";
$result=mysqli_query($conn,$query);
if (!$result) {
die('Could not query:' . mysql_error());
}
else // if (!$result)
{
////to know if there is a data///
if(mysqli_num_rows($result)==0){
echo "Sorry,no matching result";
echo $back;
exit();
}
else // if(mysqli_num_rows($result)==0){
{
//////////////Getting the data////////////////////
while($record=mysqli_fetch_assoc($result)){
while(list($name,$value)=each($record)){
echo $name.":".$value."</br>";
}
echo "</br>";
}
} // if(mysqli_num_rows($result)==0)
} // if (!$result)
echo $back;
Best of luck.