Search Engine
| From: | Dhaval Desai | Date: | Fri, 15 Sep 2000 16:27:51 +0000 |
| Subject: | Search Engine | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16949@lists.php.net to get a copy of this message | ||
Hi Guys..
I have a made a simple search engine...
Now I have a form page which takes the Input and then
searches for the string entered by the user..
THe thing is that the search matches the whole of the
word and brings the output. I want to get the output
even if there is a slightest match..from the string
entered by the users..
My code is as follows:
This is the Php3 page which is called by the html form
page:
<?php
if($tel)
{
//connecting
$connection = mysql_connect("localhost");
//selecting the database
$select = mysql_select_db("dhaval", $connection);
//sql connection
$sql = "select * from test where tel='$tel'";
$sql_result = mysql_query($sql,$connection) or
die("problems connecting to the database");
echo"<table border=\"0\"><tr bgcolor=\"Gray\">
<th valign=\"top\"><font face=\"Arial\" size=\"2\"
color=\"White\">Name</font></th>
<th valign=\"top\"><font face=\"Arial\" size=\"2\"
color=\"White\">Personality</font></th>
<th valign=\"top\"><font face=\"Arial\" size=\"2\"
color=\"White\">Tel</font></th>
<th valign=\"top\"><font face=\"Arial\" size=\"2\"
color=\"White\">Fax</font></th>";
while($row = mysql_fetch_array($sql_result))
{
$name = $row["name"];
$person = $row["personality"];
$tel = $row["tel"];
$fax = $row["fax"];
echo"<tr bgcolor=\"#2FB5CC\">
<td><font face=\"Arial\" size=\"2\"
color=\"White\">$name</font></td>
<td><font face=\"Arial\" size=\"2\"
color=\"White\">$person</font></td>
<td><font face=\"Arial\" size=\"2\"
color=\"White\">$tel</font></td>
<td><font face=\"Arial\" size=\"2\"
color=\"White\">$fax</font></td>
</tr>";
}
echo"<table>";
mysql_free_result($sql_result);
mysql_close($connection);
}
else
{
echo"Please select a telephone number from the List";
}
?>
******************************************************
I think it's possible by using the % sign but I don't
know How to use..Please help me Guys..
********************************************************
Thanx a lot!!!
Dhaval Desai
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/