hi, i am trying to play with string. so i need some suggestion.
for example i have a database containing id, book name, author name, publish year. now i would like to make a php script that will search book information from the database. User may type part of the book name or author name, may be uppercase or lowercase problem or spell mistake then how could i provide a good search result?
Database:
store(id, book_title, author, publish_year)
form:
result.php :
for example i have a database containing id, book name, author name, publish year. now i would like to make a php script that will search book information from the database. User may type part of the book name or author name, may be uppercase or lowercase problem or spell mistake then how could i provide a good search result?
Database:
store(id, book_title, author, publish_year)
form:
HTML:
<form method="post" action="result.php">
<table >
<tr>
<td ><strong>Book Name</strong></td>
<td ><strong>Author</strong></td>
</tr>
<tr>
<td><input name=book_name type=text ></td>
<td><input name=author type=text ></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit name=Search value=Search></td>
</tr>
<table>
</form>
result.php :
PHP:
<?php
$title=$_POST['book_name'];
$author = $_POST["author"];
$sql=mysql_query("select * from store where book_title like %$title% or author like %$author% ");
$db=mysql_query($sql);
?>