Created
March 9, 2011 14:36
-
-
Save Motoma/862284 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 | |
// Our Database Class | |
include("lib/database.php"); | |
$db = new Database(); // Instantiate our Database Class | |
$resArr = $db->query("SELECT * FROM users WHERE userid != 1"); // Query! | |
// $resArr is now an associative array containing the entire result set | |
// of the SQL query. We can now use and abuse this data as necessay. | |
// In this hypothetical situation, I am returing all of the users in | |
// my table except the Administrator | |
echo '<table><tr><th>UserID</th><th>UserName</th>'; | |
echo '<th>RealName</th><th>Homepage</th></tr>'; | |
foreach($resArr as $user) | |
{ | |
echo '<tr><td>'.$user['userid'].'</td><td>'.$user['username'].'</td>'; | |
echo '<td>'.$user['realname'].'</td><td>'.$user['homepage'].'</td></tr>'; | |
} | |
echo "</table>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment