hisham
IS-IT--Management
- Nov 6, 2000
- 194
How can I search for any part of the field?
I used where (name like '$s_name') to search the whole field, i.e. I want to input “jua” in the form to retrieve juan and juana etc…
<?php
//connections goes here
if($submit){
$query="select name,phone,email from contact where (name like '$s_name')";
$result=mysql_query($query)or die ("Error in query: $query. " . mysql_error());
$num=mysql_num_rows($result);
}
?>
<html>
<body>
<form method="post" action="<?php echo $PHP_SELF ?>">
<table align="center">
<tr>
<td><input type="text" name="s_name"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value=" search "></td>
</tr>
</table>
</form>
Thanks in advance.