result mysql_query SELECT FROM books WHERE _POST searchtype like searc

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
$result = mysql_query ( "SELECT * FROM books WHERE ".$_POST['searchtype']." like '%".$searchterm."%'" );
$i=1;
while($row = mysql_fetch_array($result))
{
echo "<p><b>".($i++) . $row['title']."</b><br>";
echo "Автор: ".$row['author']."<br>";
echo "ISBN: ".$row['ISBN']."<br>";
echo "Цена: ".$row['price']."<br>";
echo "Количество: ".$row['quantity']."</p>";
}
if ( $i == 1 ) echo "Ничего не можем предложить. Извините";
mysql_close( );