Hi All, I am running the below code to do a search of a database table, I am trying to do find the best way to search a field for a number of different things like:
field = NPO
keys to search = blind, deaf, sight, see, %ear%
when searching the field for ear it also looks for hear, hearing, but not earing
<?php
ini_set('display_errors', 'ON');
ini_set('error_reporting', E_ALL | E_STRICT );
$db_conn = mysql_connect("localhost", "dis-ro-dev", "ars123abc") OR die("Could not connect to the MySQL server!");
mysql_select_db("dis-dev", $db_conn) OR die("Could not select the database!");
$query = "SELECT * FROM test WHERE PNO="%deaf%'" OR "blind" OR "dog guide";
$result = mysql_query($query);
$rows = mysql_numrows($result);
$i=0;
while ($i < $rows) {
$pno=mysql_result($result,$i,"PNO");
$address=mysql_result($result,$i,"address");
echo $pno." ".$address;
$i++;
}
mysql_close($db_conn);
?>
I error thats happening is that its not giving me all of the listing for the criterias, but if I enter them in with out putting % around it works:
this code is the base for a more detailed code, but I am starting here to make it easer as I add things I can make sure it works
Any help would be greatful, if you know of a good tutorial on doing this kind of thing
Sincerely,
Christopher