<html><head><title>MySQL user table</title></head>
<body>
<table border=1>
<tr><th>Host</th><th>User</th><th>Password</th></tr>
<?php
 // connect
 require_once('DB.php');
 $db = DB::connect("mysql://root:sqladmin@localhost/mysql");
 if (DB::iserror($db)) {
   die($db->getMessage( ));
 }

 // issue the query
 $sql = "SELECT Host, User, Password FROM user";

 $q = $db->query($sql);
 if (DB::iserror($q)) {
   die($q->getMessage( ));
 }

 // generate table
 while ($q->fetchInto($row)) {
echo "<tr><td>$row[0]</td>";
echo "    <td>$row[1]</td>";
echo "    <td>$row[2]</td>";
echo "</tr>";
 }
?>
</table>
</body></html>

user.php (last edited 2009-10-30 12:38:37 by 183-56-197)

Copyright 2008, SoftXS GmbH, Switzerland