Jump to content


Photo

Help handling Mysql results


  • Please log in to reply
No replies to this topic

#1 oracle259

oracle259
  • Members
  • PipPipPip
  • Advanced Member
  • 119 posts

Posted 26 September 2006 - 05:05 AM

How do i go about checking if a word stored in a database is included in word submitted from a form. For example:

form input = clansman
database input = clan

for far i have tried the following:

while ($rec = mysql_fetch_array($result)) {
$database[] = $rec[word];
}

foreach ($database as $db) {
if (stristr(trim($userinput), $db)) {
echo "$db is a subsect of $userinput";
}
}

But it produces alot of loops of the echo statement.

What am i doing wrong




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users