Skip to content
Permalink
8c16ae6061
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
33 lines (24 sloc) 603 Bytes
<html>
<table>
<tr>
<td>Name</td>
<td>Age</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=test", $username, $password);
// Identify name of table within database
$table = 'age';
// 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['Name'] . "</td><td>" . $rows['Age'] . "</td></tr>";
};
?>
</table>
</html>