Here's a shortened version of the code:
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
$con = mysql_connect("","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("kjv", $con);
$sql = "SELECT count(*) AS totalrows FROM bible WHERE 1=1 AND";
$sql .= " CASE WHEN text_data LIKE '%angel%' THEN 1 ELSE 0 END + CASE WHEN text_data LIKE '%appeared%' THEN 1 ELSE 0 END + CASE WHEN text_data LIKE '%flame%' THEN 1 ELSE 0 END + CASE WHEN text_data LIKE '%midst%' THEN 1 ELSE 0 END + CASE WHEN text_data LIKE '%looked%' THEN 1 ELSE 0 END + CASE WHEN text_data LIKE '%behold%' THEN 1 ELSE 0 END + CASE WHEN text_data LIKE '%burned%' THEN 1 ELSE 0 END + CASE WHEN text_data LIKE '%consumed%' THEN 1 ELSE 0 END > 3";
//$sql .= " LIMIT 0, 10";
$result = mysql_query($sql) OR exit( 'Error: ' . mysql_error());
function highlight ( $str, $words )
{
if ( is_array( $words ) ) {
rsort($words);
$words = array_map( 'preg_quote', $words );
$words = join( $words, '|' );
} else {
$words = preg_quote( (string)$words );
}
//$re = '<span style="color: red; font-weight:bold;">$1</span>';
$color[0] = "red";
$color[1] = "blue";
//for($c=0; $c < 8; $c++){
//echo $color[$c]."<br />";
$re = '<span style="color: '.$color[0].'; font-weight:bold;">$1</span>';
//}
return preg_replace( '/\b(' . $words . ')\b/i', $re, $str );
}
echo $row['totalrows']."<br />";
$recCount = 1;
while($row = mysql_fetch_array($result)){
echo "<span id='regular[]' style='padding: 5px; background-color: #D2C5A0; display: block; border: 1px solid #7C7C7C; color: black;'>";
echo "<span style='font-weight: bold; color: black; background-color: #B4B3A9; display: block; border: 1px solid #7C7C7C;'>"."<span style='font-weight: normal;'> ".$recCount."</span> ".$row["book_title"]." ".$row["chapter"].":".$row["verse"]." ";
echo "</span>\n";
$str = $row['text_data'];
//var_dump( highlight( $str, $newSearchTheseArr));
echo highlight( $str, $newSearchTheseArr);
echo "</span><br />\n";
$recCount++;
}
mysql_close($con);
?>
</body>
</html>