unable to login even the data is inside the database!!
Posted: Sun Jul 01, 2007 8:17 am
feyd | Please use
but even if what i input in user.html have enter my database, when i login again, it will display invaild user id
i wonder what is wrong??? i change my code many time but i still duno wat cost the problem...
cn help??
thank
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
i dont know why my do_login.php is not working....i not sure issit fetch array problem or rows problem....
here the codeCode: Select all
<?php
session_start();
require('db.php');
// Get the variables
$user = $_POST['username'];
$password = md5($_POST['password']);
mysql_connect(MACHINE, USER, '');
mysql_select_db(DBNAME);
$sql = "SELECT * FROM user Where username = '$user' and password = '$password'";
$result = mysql_query($sql);
//$rows = mysql_num_rows($result);
if ($rows == 1)
//if (mysql_num_rows($result) == 1)
{
$_SESSION['username'] = $user;
echo "Login sucessful, click "."<a href = '../user/index.php'>here</a>"." to proceed.";
}else if (($rows == 0) and ($user)){
echo "Invaild password, click "."<a href = '../user/user.html'>here</a>"." to re-enter password";
} else if ((!$user) and ($row == 0))
{
echo "Invaild User id, click "."<a href = '../user/user.html'>here</a>"." to re-enter username";
}
?>i wonder what is wrong??? i change my code many time but i still duno wat cost the problem...
cn help??
thank
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]