anonymous
2013-06-27 14:59:02 UTC
mysql_select_db("randomData",$connect);
$query = "SELECT * FROM randomTable WHERE Gender='" . $gender ."'";
$results = mysql_query($query);
while($row = mysql_fetch_array($results)){
echo $row['Name'] . " " . $row['Surname'] . "
" . $row['Email'] . "
" . "
";
}
This code works perfectly well for what I intended. But it only allows you to search by male or female because I have it searching the column that indicates gender. If I search "female" it will yield the names Jennifer and Julie along with their emails and last names. But if I try searching the actual name "jennifer" nothing comes up. How can I search the entire database for any key work and it will return anything associated with it? Also how do you distinguish how easily it will make a match? for example if I put in "jennif" would that be enough to yield Jennifer's info?