searpl
setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
$stmt = $db->prepare($sql);
$stmt->execute($params);
$rows = array();
$scores = array();
while ($row = $stmt->fetch()) {
$score = 0;
foreach ($terms as $param)
$score = $score + substr_count($row['content'],$param);
array_push($scores, $score);
$row['score'] = $score;
array_push($rows, $row);
}
array_multisort($scores, SORT_DESC, $rows);
$results = false;
foreach ($rows as $row) {
$results = true;
if (substr($row['url'],-1,1)=='/')
continue
?>
(score: )
...'.htmlspecialchars($param).'';
echo htmlspecialchars(substr($content,$pos+strlen($param),50)).'...';
}
}
?>
No results.
';
}
?>