MySQL n00b seeks help!
Posted: Wed Aug 27, 2003 2:58 pm
I've only just started using MySQL with PHP
and I've got some problems with the source code below. Can anyone spot the problem? It's very messy because I'm trying to find out what's wrong...
THANKYOU!
edg
Code: Select all
if ($db = mysql_connect("localhost", "block", "block")) {
echo ("Connected");
} else {
echo ("error");
}
mysql_select_db("test", $db);
$result = mysql_query("SELECT COUNT(*) FROM users", $db);
$rows = mysql_result($result,0,);
echo ("<table>");
echo ("<tr>");
echo ("<td>Username</td>");
for ($i=0; $i<$rows; $i++) {
echo("<td>");
$result = mysql_query("SELECT * FROM users", $db);
echo(mysql_result($result, $i, "username"));
echo("</td>");
}
echo ("</tr>");
echo ("<tr>");
echo ("<td>Password</td>");
for ($i=0; $i<$rows; $i++) {
echo ("<td>");
$result = mysql_query("SELECT * FROM users", $db);
echo(mysql_result($result, $i, "password"));
echo ("/td>");
}
echo ("</tr>");
echo ("</table>");
?>edg