<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
// Add class to script.
require_once("class.xDatabase.php");
// Create new MySQL database object.
$database = new xDatabase("localhost", "root", "", "mysql");
// Make query from "mysql" -database, using "Host" -column information as index.
$results = $database->query("SELECT Host, User, Password FROM user WHERE User != ''", "Host");
// Display results from query.
echo "Total number of rows in result set : ".$database->DB_RESULT_ROWS."<br><br>\n";
echo "<table width=\"80%\" border=\"1\" cellspacing=\"0\" cellpadding=\"1\">\n";
foreach ($results['localhost'] as $local_user)
{
echo "<tr><td>".$local_user['Host']."</td><td>".$local_user['User'];
echo "</td><td>".$local_user['Password']."</td></tr>\n";
}
echo "</table>\n";
// Close database connection.
$database->close();
?>
</body>
</html>
|