MySQL (2 tables)
| From: | bryan | Date: | Tue, 17 Oct 2000 20:14:08 +0000 |
| Subject: | MySQL (2 tables) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-3696@lists.php.net to get a copy of this message | ||
I have 2 tables in my database (users, and auth). My query is SELECT *
FROM users; but I only want to show that query if the user is a member
(from the auth table)
I have a $PHP_SELF function in my form so when the user logs in, if it is
valid, they are shown the data from the users table. Could someone tell me
how to validate the username && password from the AUTH table and show the
data from the USERS table..
Thanks...
bryan
eg.
<?php
If (($username == username) && ($password == password)) {
print "<TABLE $table_params>";
print "<TR>";
if ((!$result) || ($numrows < 1)) {
echo "<H1>ERROR - no rows returned</H1><P>"
}
print "</TR>";
while ($row = mysql_fetch_array ($result)) {
print "<TR>";
echo "<TD><U><B>ID
Number:</TD></U></B>".
"<TD>".$row[0]."</TD>";
echo "<TD><U><B>Name:</U></B></TD>
"."<TD>".$row[1]." ".$row[2]."</TD>";
print "<TD><a href=\"mailto:" .
$row[3] . "\">". "E-mail
me</a>";
print "</TR>";
}
print"</TABLE>";
mysql_free_result ($result);
?>
Today's Date (according to the web server) is:
<?php
echo( date("F dS Y.") );
} else {
echo "<a href=login.html>LOG-IN</a>";
}
?>