note 33010 added to function.mysql-query

From: Date: Fri, 13 Jun 2003 17:08:24 +0000
Subject: note 33010 added to function.mysql-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-50295@lists.php.net to get a copy of this message
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); ?> ---- Manual Page -- http://www.php.net/manual/en/function.mysql-query.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33010 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33010&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33010&report=yes

« previous php.notes (#50295) next »