Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<html>
<table>
<tr>
<td>Page_ID</td>
<td>Page_Title</td>
<td>Page_Content</td>
<td>Featured_Image</td>
<td>sign_up_date</td>
<td>email</td>
</tr>
<?php
// Enter username and password
$username = root;
$password = root;
// Create database connection using PHP Data Object (PDO)
$db = new PDO("mysql:host=localhost;dbname=mysql-practice-2", $username, $password);
// Identify name of table within database
$table = 'test';
// Create the query - here we grab everything from the table
$stmt = $db->query('SELECT * from '.$table);
// Close connection to database
$db = NULL;
while($rows = $stmt->fetch()){
echo "<tr><td>". $rows['Page_ID'] . "</td><td>" . $rows['Page_Title'] . "</td><td>" . $rows['Page_Content'] . "</td><td>" . $rows['Featured_Image'] . "</td><td>" . $rows['sign_up_date'] . "</td><td>" . $rows['email'] . "</td></tr>";
};
?>
</table>
</html>