Page 1 of 1

how multiple search in single input

Posted: Thu Aug 16, 2007 2:52 pm
by aris1234
Hi All...

how searching by name or email or no telp in single input (box) ??

its code my html form

Code: Select all

<form action="result.php" method="POST">
   <input type="text" name="find" >
   <input type="submit" name="search" value="search" >
</form>

i use php code like this :

Code: Select all

$find	= $_POST["find"];  // from  name input type in form

$query 	= "SELECT * FROM register WHERE name_child AND email AND nohp LIKE '%$find%' ORDER BY name_child ASC";
$NumResult = mysql_query($query);
$result	= mysql_numrows($NumResult);
that code above no have result, and i try like below this have same result :

Code: Select all

$query 	= "SELECT * FROM register WHERE name_child LIKE '%$find%' AND email LIKE '%$find%' AND nohp LIKE '%$find%' ORDER BY name_child ASC";
$NumResult = mysql_query($query);
$result	= mysql_numrows($NumResult);
im try too using OR but result have same

please help me the solotion

Posted: Thu Aug 16, 2007 2:59 pm
by thinsoldier

Code: Select all

$query  = "SELECT * FROM register 
WHERE (name_child LIKE '%$find%') 
OR (email LIKE '%$find%') 
OR (nohp LIKE '%$find%')
ORDER BY name_child ASC";
maybe

Posted: Thu Aug 16, 2007 3:13 pm
by aris1234
that code work ...

thanks

:wink: soldeir