note 33010 deleted from function.mysql-query by pollita
| From: | pollita@php.net | Date: | Fri, 13 Jun 2003 18:27:40 +0000 |
| Subject: | note 33010 deleted from function.mysql-query by pollita | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-50298@lists.php.net to get a copy of this message | ||
Note Submitter: tannernett@yahoo.com
----
Hey everyone im fresh to mysql and php and i am trying to learn how to create a username password
system. i have already made the page to INSERT any desired username and password into the correct
table and it works, but i have no idea how to check the DB and tell whether or not the password
submitted matches the username. heres what i came up with by myself (it doesnt work) maybe one of
you php gurus can help me out. -tanner
<?php
$link = mysql_connect("68.52.3.100", "client", "client") or
die("Could not connect : " . mysql_error());
mysql_select_db("bixlerfanclub") or die("Could not select database");
$sql = 'SELECT pword FROM members WHERE 1 AND uname LIKE "$name" LIMIT 0, 30';
$pass = mysql_query("SELECT pword FROM members") or die("Invalid query: " .
mysql_error());
if ($password == $pass) {
echo "<a href="myfile.html">click here</a>";
} else{
echo "Sorry but your password is invalid";
}
mysql_close($link);
?>