Old Testiment: Song of Solomon: 22: 1: 2
Let him kiss me with the kisses of his mouth: for thy LOVE [is] better than wine.
<?php
include("includes/mobile_header.php");
echo('<h2>Tedd\'s Mobile Android $_GET</h2>');
$id = isset($_GET['id']) ? $_GET['id'] : 1;
$search = '';
switch($id)
{
case (1);
$search = 'LOVE';
break;
case (2);
$search = 'COURAGE';
break;
case (3);
$search = 'HOPE';
break;
case (4);
$search = 'JESUS';
break;
default;
exit();
}
$con = '';
include('includes/open-db.php'); //====== open dB
$query = "SELECT * FROM kjv WHERE vtext LIKE '%$search%' ORDER BY RAND() LIMIT 1";
$result = mysqli_query($con, $query) or die(mysqli_error($con));
while ($row = mysqli_fetch_array($result)) // pull data from result and display
{
$id = $row['id'];
$testiment = $row['bsect'];
$book = $row['bname'];
$book_num = $row['bnum'];
$chap_num = $row['cnum'];
$v_num = $row['vnum'];
$v_text = $row['vtext'];
}
if ($testiment == 'O')
{
$testiment = 'Old Testiment';
}
else
{
$testiment = 'New Testiment';
}
$v_text = red($v_text, $search);
echo("<p>$testiment: $book: $book_num: $chap_num: $v_num</p>");
echo("<p>$v_text</p>");
include('includes/close-db.php'); //====== close dB
include("includes/mobile_footer.php");
//-------------- highlight search text--------------
// this function accepts a string and a search phrase
// and places search phrase between a span to highlight
// the search phrase with a yellow background and red text
// see css for standout class.
function red($str, $search_text)
{
$search_text = strtoupper($search_text);
$start = "<span class=\"standout\">";
$end = "</span>";
$phrase = $str;
$good = $start . $search_text . $end;
$bad = $search_text;
$str = str_ireplace($bad, $good, $phrase);
return $str;
}
?>