Jump to content

search into MySql database


kathierry2106

Recommended Posts

hello to all!

I'm looking for php script codes of search that will search into

to Retrieve all the records that match to the the search string am entering in the form of search

 

mysql database "library_bank" with

3 tables : book, journal, cd

 

***

<html>

<head><title>Searching the Database_library</title>

</head>

<body bgcolor=#ffffff>

<CENTER><h2>Searching the Database Library</h2>

</CENTER>

 

<form method="post" action="check_database.php3">

<table width=90% align=center>

<tr><td>search for BOOK, JOURNAL, CD-ROM,...:</td>

<td><input type=text name='search' size=60 maxlength=255></td></tr>

<td></td>

 

<td><input type=submit VALUE='SEARCH'></td></tr>

</table>

</form>

 

</body>

</html>

 

*****

any help will be highly appreciated

Thanks in advance

best reagards

Thierry

Link to comment
Share on other sites

hello to all!

I'm looking for php script codes of search that will search into

to Retrieve all the records that match to the the search string am entering in the form of search

 

mysql database "library_bank" with

3 tables : book, journal, cd

 

***

<html>

<head><title>Searching the Database_library</title>

</head>

<body bgcolor=#ffffff>

<CENTER><h2>Searching the Database Library</h2>

</CENTER>

 

<form method="post" action="check_database.php3">

<table width=90% align=center>

<tr><td>search for BOOK, JOURNAL, CD-ROM,...:</td>

<td><input type=text name='search' size=60 maxlength=255></td></tr>

<td></td>

 

<td><input type=submit VALUE='SEARCH'></td></tr>

</table>

</form>

 

</body>

</html>

 

*****

any help will be highly appreciated

Thanks in advance

best reagards

Thierry

Are you looking to have it return specific results, like this book exists or use a 'fuzzy' search where if something is close it will still return it.
Link to comment
Share on other sites

Simple search query. Example

 

  
<input name="searchTerm" type="text">
<input type="submit" name="Submit" value="Search">

<?php
if($_REQUEST['Submit'] == "Search")
{
$searchTerm = $_REQUEST['searchTerm'];

include("../connDB.php");

$sql_search_subject = "SELECT * FROM subject WHERE SCode = '$searchTerm' ";
if( $searchTerm == ''){
}elseif(!$q_search_subject = mysql_query($sql_search_subject))
{
	echo "<font color=white></font>";
}

elseif(!mysql_num_rows($q_search_subject))
{
	echo "<center>Search Results... No record found!</center>";
}

else
{
     
	while($r_search_subject = mysql_fetch_assoc($q_search_subject))
	{
                     $SCode=$r_search_subject['SCode']; echo"$SCode";
                     $SDesc=$r_search_subject['SDesc']; echo"$SDesc";
                 }
         }
}
?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.