ISBN search engine
Posted: Tue Mar 08, 2005 9:27 am
Hi guys, I'm having a little trouble searching through tables that have a column labelled 'isbn', with values such as "1291849202" or "817263892X". The column is set to varchar(10), please let me know if you have any ideas. My code looks like this:
feyd | Please use
Code: Select all
<?php
$searchtype=$HTTP_POST_VARSї'searchtype'];
$searchterm=$HTTP_POST_VARSї'searchterm'];
$searchterm= trim($searchterm);
if (!$searchtype || !$searchterm)
{
echo 'You have not entered search details. Please go back and try again.';
exit;
}
$searchtype = addslashes($searchtype);
$searchterm = addslashes($searchterm);
$display = 10;
if (isset($_GETї'np'])) {
$num_pages = $_GETї'np'];
} else {
$query = "e;SELECT * FROM books, course WHERE "e;.$searchtype."e; like '%"e;.$searchterm."e;%' AND books.isbn = course.isbn"e;;
$query_result = mysql_query ($query);
$num_results = @mysql_num_rows($query_result);
.
.
And the search engine looks like:
<tr>
<td>Choose Search Type:
<select name="e;searchtype"e;>
<option selected value="e;name"e;>Book Title</option>
<option value="e;author"e;>Author</option>
<option value="e;publisher"e;>Publisher</option>
<option value="e;isbn"e;>ISBN Code</option>
</select></td>
</tr>
<tr>
<td>Enter Search Term:
<input type="e;text"e; name="e;searchterm"e;></td>
</tr>feyd | Please use
Code: Select all
tags whileCode: Select all
is offline.[/color]