$author=$_POST[‘author’];
$title=$_POST[‘title’];
$isbn=$_POST[‘isbn’];
$publication=$_POST[‘publication’];
$edition=$_POST[‘edition’];
$noofcopies=$_POST[‘noofcopies’];
$category=$_POST[‘category’];
$datepurchase=$_POST[‘datepurchase’];
$price=$_POST[‘price’];
if ($author == “”)
{
$author = ‘%’;
}
if ($title == “”)
{
$title = ‘%’;
}
if ($isbn == “”)
{
$isbn = ‘%’;
}
if ($publication == “”)
{
$publication = ‘%’;
}
if ($edition == “”)
{
$edition = ‘%’;
}
if ($noofcopies == “”)
{
$noofcopies = ‘%’;
}
if ($category == “”)
{
$category = ‘%’;
}
if ($datepurchase == “”)
{
$datepurchase = ‘%’;
}
if ($price == “”)
{
$price = ‘%’;
}
$result = mysql_query (“SELECT * FROM book WHERE author LIKE ‘$author%’ , title LIKE ‘$title%’ , isbn LIKE ‘$isbn%’ , publication LIKE ‘$publication%’ , edition LIKE ‘$edition%’ , noofcopies LIKE ‘$noofcopies%’ , category LIKE ‘$category%’ , datepurchase LIKE ‘$datepurchase%’ AND price LIKE ‘$price%’”);
$num_rows = mysql_num_rows ($result);
echo “There are $num_rows records.
”;
if ($row = mysql_fetch_row($result))
{
do {
echo “
$field | \n”;
}
while($row = mysql_fetch_row($result));
}
else
{
echo “Sorry, no records were found!”;
}
mysql_close($link);
?>