Пример #1
0
function viewScripturesByBook($book_id = "-1")
{
    global $test;
    if ($book_id == "-1") {
        $scriptures = viewScriptures();
    } else {
        $query = 'SELECT scriptures.scripture_id, scriptures.chapter, scriptures.verse, scriptures.content, books.name
		FROM scriptures
		INNER JOIN books
		ON scriptures.book_id = books.book_id
		WHERE scriptures.book_id = :book_id
		ORDER BY books.name';
        $statement = $test->prepare($query);
        $statement->bindValue(":book_id", $book_id);
        $statement->execute();
        $scriptures = $statement->fetchAll();
        $statement->closeCursor();
    }
    return $scriptures;
}
Пример #2
0
<?php

function test()
{
    $server = 'localhost';
    $database = 'cs313test';
    $username = '******';
    $password = '******';
    $dsn = 'mysql:host=' . $server . ';dbname=' . $database;
    $options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
    $g1db = new PDO($dsn, $username, $password, $options);
    echo "Just called PDO function";
    echo $gldb;
    return $g1db;
}
echo "pre test()";
$test = test();
$scriptureOutput = viewScriptures();
echo "IS this working?";
echo $scriptureOutput;
function viewScriptures()
{
    global $test;
    $query = 'SELECT * FROM scriptures
              ORDER BY id';
    $statement = $test->prepare($query);
    $statement->execute();
    return $statement;
}
?>
<h1></h1>
Пример #3
0
			<li><a data-toggle="tab" href="#menu2">Faith</a></li>
			<li><a data-toggle="tab" href="#menu3">Sacrifice</a></li>
		  </ul>

		  <div class="tab-content">
			<div id="home" class="tab-pane fade in active">
			  <h3>All Scriptures</h3>
				  <table id="t01">
						<tr>
							<th>Book</th>
							<th>Ch:Vs</th>
							<th>Content</th>
							<th>Topics</th>
						  </tr>
						<?php 
$scriptures = viewScriptures();
foreach ($scriptures as $scripture) {
    ?>
							<tr>
								
								<td><?php 
    echo $scripture["name"];
    ?>
</td>
								<td><?php 
    echo $scripture["chapter"];
    ?>
:<?php 
    echo $scripture["verse"];
    ?>
</td>