Searching Database with PHP
Posted: Thu Jul 30, 2009 3:18 pm
I need to be able to search a row for a given string, but I am having trouble. This is what I have:
I need to add code so that if there are several words in the database and the $string matches at least one of the words then it will echo "String found!"
Foxy
Code: Select all
$string = "toSearch";
while($row = mysql_fetch_array($result))
{
if($row['name'] == $string)
{
echo "String found!";
}
}
Foxy