Hi All, I Have a PHP Searching Code it have some problem it only connet to database but does not show any result..........
PHP Code is :-
Search.php
<HTML>
<BODY>
<FORM Action="/Search.php" Method="POST">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td bordercolor="#000000">
<p align="center">
<select name="metode" size="1">
<option value="name">Name</option>
<option value="telephone">Telephone</option>
<option value="birthday">Birthday</option>
</select> <input type="text" name="search" size="25"> <br>
Search database: <input type="submit" value="Go!!" name="Go"></p>
</td>
</tr>
</table>
</div>
</form>
<center>
<table border="1" cellpadding="5" cellspacing="0" bordercolor="#000000">
<tr>
<td width="60"><b>ID</b></td>
<td width="100"><b>Name</b></td>
<td width="70"><b>Telephone</b></td>
<td width="150"><b>Birthday</b></td>
</tr>
<?php
if ($_POST['Go'])//user clicks go..
{
$dbh=mysql_connect ("localhost", "kuchcity_hemant", "hemgoyal") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("kuchcity_example");
?>
<?php
//error message (not found message)begins
$XX = "No Record Found, to search again please try again";
//query details table begins
$query = mysql_query("SELECT * FROM details WHERE '$_POST[metode]' LIKE '$_POST[search]'% LIMIT 0, 50");
while ($row = @mysql_fetch_array($query))
{
$variable1=$row["ID"];
$variable2=$row["Name"];
$variable3=$row["Telephone"];
$variable4=$row["Birthday"];
//table layout for results
print ("<tr>");
print ("<td>$variable1</td>");
print ("<td>$variable2</td>");
print ("<td>$variable3</td>");
print ("<td>$variable4</td>");
print ("</tr>");
}
//below this is the function for no record!!
if (!$variable1)
{
print ("$XX");
}
//end
}
?>
</table>
</center>
</BODY>
</HTML>
any one plz help me......