Help with a bit of code
Posted: Fri Apr 25, 2003 7:28 pm
Hey, I get an error when I run this:
I am trying to familiarize myself with the MySQL functions, but obviously I haven't gotten to far.
Thanks for any help provided.
Code: Select all
<?php
$dbConn = mysql_connect("localhost", "user", "pass");
if (!$dbConn)
{
echo("Failed to connect to MySQL server.");
exit();
}
if (!@mysql_select_db("user"))
{
echo("Failed to select MySQL database..");
exit();
}
$q = "select * from users";
$result = mysql_query($q);
echo <<<BTABLE
<table border="0" width=50%>
<tr><th>User ID:</th><th>User Password:</th><th>Account Created:</th></tr>
BTABLE;
if (!$result)
{
echo("Failed to select users from MySQL database.");
exit();
}
while ($row = mysql_fetch_array($result))
{
echo '<tr><td>' . $rowї"user_id"] . '</td><td>' . $rowї"password"] . '</td><td>' . $rowї"created"] . '</td>';
echo("<td><a href="deleteUser.php?user_id=" . $rowї"user_id"] . "">Delete User</a></td></tr>");
}
echo <<<ETABLE
</table>
ETABLE;
?>Thanks for any help provided.