Created
February 22, 2012 17:46
-
-
Save BaylorRae/1886283 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// connect to the db | |
$mysql = new mysqli('localhost', 'root', 'root', 'users'); | |
/* | |
* This is the "official" object oriented way to do it, | |
* BUT $connect_error was broken until PHP 5.2.9 and 5.3.0. | |
*/ | |
if ($mysql->connect_error) { | |
die('Connect Error (' . $mysql->connect_errno . ') ' | |
. $mysql->connect_error); | |
} | |
$people = $mysql->query("SELECT `id`, `name` FROM `people`"); | |
if( $people == false ) { | |
die('Failed to get all people: ' . $mysql->error); | |
} | |
$mysql->close(); | |
?> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>People</title> | |
<meta charset="utf-8" /> | |
<style> | |
html { | |
background: #f0f0f0; | |
margin: 0; | |
padding: 0; | |
} | |
body { | |
font-family: Helvetica Neue, Helvetica, Arial, sans-serif; | |
font-weight: 300; | |
width: 300px; | |
margin: 40px auto; | |
background: #fff; | |
padding: 20px; | |
} | |
h2 { | |
margin: 0; | |
padding: 0; | |
text-align: center; | |
} | |
</style> | |
</head> | |
<body> | |
<h2>The People</h2> | |
<ul> | |
<?php | |
while( $person = $people->fetch_object() ) { | |
echo '<li><strong>', $person->id, '</strong> - ', $person->name, '</li>'; | |
} | |
?> | |
</ul> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Alias /phpMyAdmin "/Applications/MAMP/bin/phpMyAdmin" | |
<Directory "/Applications/MAMP/bin/phpMyAdmin"> | |
Options Indexes MultiViews | |
AllowOverride None | |
Order allow,deny | |
Allow from all | |
</Directory> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment