mysql_connect("localhost", "phpuser", "password");
mysql_select_db("phpdb");
$result = mysql_query("SELECT * FROM usertable");
if ($result && mysql_num_rows($result)) {
$numrows = mysql_num_rows($result);
$rowcount = 1;
print "There are $numrows people in usertable:
";
while ($row = mysql_fetch_assoc($result)) {
print "Row $rowcount
";
foreach($row as $var => $val) {
print "$var: $val
";
}
print "
";
++$rowcount;
}
}