0
0

Website refactored

Converted MySQLi Database.php class to PHP_PDO objects
This commit is contained in:
Bryan
2019-05-29 19:27:41 +02:00
parent 71e028cfdb
commit 63689ae0e9
5 changed files with 42 additions and 38 deletions

View File

@@ -7,7 +7,6 @@
$database->prepare ( "SELECT links.ID, links.URL FROM links WHERE links.created_by = " . $_SESSION [ 'user_id' ] );
$database->execute ( );
$result = $database->get_result ( );
$row = $result->fetch_assoc ( );
?>
<!DOCTYPE html>
<html>
@@ -19,13 +18,14 @@
<button onclick="logout()">Logout</button>
<div id="urllist">
<?php
if ( ! $row ) {
if ( $result->rowCount ( ) == 0 ) {
echo ( "You have not created any URL yet.<br>" );
}
else {
do {
$rows = $result->fetchAll ( PDO::FETCH_ASSOC );
foreach ( $rows as $row ) {
echo ( "\t\t\t" . '<div>' . $row [ 'ID' ] . " | " . $row [ 'URL' ] . "</div>\n" );
} while ( $row = $result->fetch_assoc ( ) );
}
}
?>
</div>