Listing books in index.php, saveing book informations to db.
This commit is contained in:
27
index.php
Normal file
27
index.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
include 'vendor/autoload.php';
|
||||
|
||||
|
||||
set_time_limit(-1);
|
||||
|
||||
|
||||
$db = new SQLite3('data.db');
|
||||
|
||||
$stmt = $db->prepare('SELECT * FROM book ');
|
||||
//$stmt->bindValue(':nid', $bookData['nid'], SQLITE3_INTEGER);
|
||||
$result = $stmt->execute();
|
||||
echo '<pre>';
|
||||
|
||||
echo '<table style="width: 100%">';
|
||||
print('<tr> <th>id</th><th>nid</th><th>Title</th><th>Category</th><th>Publish date</th><th>Pages</th><th>Votes</th><th>Rating</th> </tr>');
|
||||
while ($resultArray = $result->fetchArray(SQLITE3_ASSOC)) {
|
||||
// print_r($resultArray);
|
||||
|
||||
printf('<tr> <td>%d</td><td>%d</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%.1f</td> </tr>',
|
||||
$resultArray['id'], $resultArray['nid'], $resultArray['title'], $resultArray['category'], $resultArray['datepublished'], $resultArray['numberofpages'], $resultArray['reviewCount'], $resultArray['ratingValue']);
|
||||
if ($resultArray) {
|
||||
$x = $resultArray;
|
||||
}
|
||||
}
|
||||
echo '</table>';
|
||||
|
||||
Reference in New Issue
Block a user