need help with PHP mysql, please need some advce.
Posted: Tue Dec 09, 2008 2:47 am
for some reason my code do not return any value. it is a simple login script. just check the username and password.
*****this is my php page NAME: auth1.php**************
----------------------------------------------------------
******this is my form page : login_page.php ***********************
please help
*****this is my php page NAME: auth1.php**************
Code: Select all
<html>
<body>
<?
$user = $_POST['user']; //post user name
$pass = $_POST['pass']; // post pass
$connection = mysql_connect(localhost, "", "");
mysql_select_db('login') or die("cannot select a database");
$get = mysql_query(SELECT * FROM login_info WHERE usr = '$user' and pass = '$pass');
$result =mysql_result($get, 0);
$close = mysql_close($connection);
if ($result != 1) echo "login failure";
else {
echo "Suceess";
};
?>
</body>
</html>******this is my form page : login_page.php ***********************
Code: Select all
<form action="auth1.php" method="post" name= "form1">
User name <input type="text" name = "user" />
Password <input type="text" name = "pass" />
<input type="submit" value = "submit" />
</form>