Jump to content

Archived

This topic is now archived and is closed to further replies.

glenelkins

search string for partial match

Recommended Posts

how can i test a sting for a partial match? i tried the following but it does not work:

[code]
// Example
$search_for = "Helen"  // full text could be Helen Lee Scott

$profileCount = 0;
while ($profileArray = mysql_fetch_array($result)) {
  // Check the bride first
  if (strpos($profileArray['bride'],$search_for) > 0) {
    // Found part of the name
    $found_profileArray[$profileCount] = $profileArray['bride'];
  }
  $profileCount++;
}

if (!empty($profileArray)) {
  ACTIONS
} else {
  ACTIONS
}
[/code]

Share this post


Link to post
Share on other sites
You might want to look into [a href=\"http://uk.php.net/manual/en/function.preg-match.php\" target=\"_blank\"]preg_match[/a] it will be more accurate.

Share this post


Link to post
Share on other sites
thanks guys will look into that

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.