Click here to Skip to main content
15,921,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys I hope you can help me with my problem I am making a library system
The main requirements in searching functions is to search Either booktitle, Author, Location of the book and the ISBN code or book code..

Here is my sample code in php

Legend: the catname part here is my category name which link to the name of my select
search name here is the input textbox where i can input the field.
Do you think my query is correct? I hope you can help me thanks

PHP
if(isset($_REQUEST['searchme']))
{
  $catname = $con->real_escape_string($_POST['catname']);
  $search = $con->real_escape_string($_POST['search']);
  $query = $con->query("select bookname,bookid,bookdesc,location,
    catname,qty,bookcode,copyright,editionnumber,publisher,author
    from books inner join categories on categories.catname=books.catname
    where  bookname LIKE '%$search%' or author LIKE '%$search%' or bookcode LIKE '%$search%'") or die(mysqli_errno());
  $result ->data_seek(0);
  while($row = $result->fetch_assoc())
  {
?>

<?php echo $row['bookname']???>
<?php <br mode="hold" /??>                }
}
?>
Posted
Updated 5-Feb-15 5:09am
v3
Comments
Patrick sarmiento 6-Feb-15 0:03am    
please help me guys

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900