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
https://forums.phpfreaks.com/topic/93298-search-into-mysql-database/
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.

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";
                 }
         }
}
?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.