mysql error
Posted: Sat Jan 11, 2003 7:28 am
Hi Guys,
Can anyone please help me on this issue.
The below code did not print all the values in the table.
Instead it printed only the ID with the values.
Please if you know how to solve the problem.
I would like to print the values in real_name,username,email,respectively
but not the password.
Thanks
Can anyone please help me on this issue.
The below code did not print all the values in the table.
Instead it printed only the ID with the values.
Please if you know how to solve the problem.
I would like to print the values in real_name,username,email,respectively
but not the password.
Thanks
Code: Select all
<?php
echo "<html><head><title>User Information</title></head><body
bgcolor=#ffffff>";
$connection = mysql_connect("localhost","user","pass")
or die ("Unable to connect to MySQL server.");
$db = mysql_select_db("secretDB", $connection) or die ("Unable to select
database.");
$sql = "SELECT id, real_name, username, email
FROM users
ORDER BY id ASC";
$sql_result = mysql_query($sql,$connection) or die ("Couldn't execute SQL
query");
echo "<center><b><u>List of users</u></b><br><Br>";
echo "<table bgcolor=#000000><Tr><td bgcolor=#000000><table cellpadding=4
cellspacing=0 bgcolor=#ffffff>"; echo "<Tr><th>ID</th><th>Full
Name</th><th>Username</th><th>E-mail</th></tr>"; while ($row =
mysql_fetch_array($sql_result)) { $id = $row["id"];
$real_name = $row["real_name"];
$username = $row["username"];
$email = $row["email"];
echo
"<tr><td>$id</td><td>$real_name</td><td>$username</td><td>
<a href="mailto:$email">$email</a></td></tr>"; }
echo "</table></td></tr></table>";
echo "</center>";
mysql_free_result($sql_result);
mysql_close($connection);
echo "</body></html>";
?>