RE: [PHP] mysql with php

From: Date: Fri, 20 May 2005 12:43:07 +0000
Subject: RE: [PHP] mysql with php
Groups: php.general 
Request: Send a blank email to php-general+get-215644@lists.php.net to get a copy of this message
> -----Original Message----- > From: Rittwick Banerjee [mailto:rittwick@hotmail.com] > Sent: Friday, May 20, 2005 3:59 AM > To: php-general@lists.php.net > Subject: [PHP] mysql with php > > > Hi friends, > > I am Rittwick Banerjee > > and i have made a mysql based user name and password program > but I found > that > what ever I entered in the user name and password feild the > php file dose > not working. > > I set this code for user name and password > > $sql = " SELECT User_name AND > User_pass FROM user WHERE > User_name= > '$_POST[user_id]' AND User_pass = > '$_POST[user_pass]' " > > But this code dose not working properly. > This code dosen't checking if the user name and password is > correct or > incorrect > > Please help me with some source code. > > Thank you. Your code seems non-sensical to me. There are lots pf considerations to take into account with passwords and security, but on a very basic level. heres what I think you're after: $sql="select User_pass from user where user_name = $_POST[user_id]"; $result=mysql_query($sql); $row=mysql_fetch_array($result); if($row[user_pass]==$_POST[user_pass]){ echo "Access Granted!" }else{ echo "Access Denied!" } JM

« previous php.general (#215644) next »