On the form user enter rego no where it search database and display the output what i am looking is, if the entered data not match its should display " Record not found."
<?php
$search_Rego = ($_POST['RegoNo']);
try
{
//open the database
$db = new PDO('sqlite:iSearch.sqlite');
$result = $db->query("SELECT Fname , Lname , RegoNo, Model, Color, MobNo, DeskNo, AltMobNo
FROM Owner
JOIN Cars ON Owner.id=Cars.Owner_id
JOIN Contacts ON Owner.id=Contacts.Owner_id
where RegoNo like '$search_Rego'");
{
foreach($result as $row)
{
echo " This Car Belongs to " ;
echo "<br />"."<br/>";
echo $row['Fname']." ". $row['Lname']."<br />";
echo $row[ 'RegoNo']. "<br/>";
echo $row['Model']." ". $row['Color']. "<br />" ;
echo "<br />";
echo $row['MobNo']. "<br />" ;
echo $row['DeskNo']. "<br />";
echo $row['AltMobNo']. "<br />";
}
}
// close the database connection
$db = NULL;
}
catch(PDOException $e)
{
print 'Exception : '.$e->getMessage();
}
?>