KJV Bible


[insert_php]
$book=$_REQUEST[“book”];
$chapter=$_REQUEST[“chapter”];
$verse=$_REQUEST[“verse”];

if ($book==””){$book=1;}
//if ($chapter==””){$chapter=0;}
$chapter=0;
//if ($verse==””){$verse=1;}
$verse=0;

$servername = “localhost”;
$username = “kjv”;
$password = “x2v77a”;
$dbname = “kjv”;

print (“

“);

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}

$sql = “SELECT *
from bible_kjv as k, bible_books_en as b
where k.book=$book and k.book=b.number”;
$result = $conn->query($sql);

if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {

if ($booknumber<>$row[“book”]){
echo “

The book of $row[fullname]

“;
$booknumber=$row[“book”];

print (“Chapter: “);
for ($i=1; $i<=$numchapters; $i++){ print ("$i “);
}
print (“


“);
}

if ($chapter<>$row[“chapter”]){
echo “

Chapter $row[chapter]

“;
$chapter=$row[“chapter”];
}

echo “

$row[verse] “;
echo $row[“text”];
echo “

“;
}
} else {
echo “0 results”;
}
$conn->close();

[/insert_php]