Hi guys!
I got a problem with my logging in system. I can connect to my database with the code:
session_start();
include('header.html');
$page_title = 'Home Page';
$mail = $_POST['email'];
$password = $_POST['password'];
$msg ='';
if(isset($mail,$password)){
$con = mysql_connect('127.0.0.1','root','');
if(!$con)
{
die('Could not connect: '.mysql_error());
}
else{
echo "Connected!";
}
}
$db_found = mysql_select_db("dbusers", $con);
Then I connect to the table and I want to retrieve the registered users details from the table "mytable" and then I want to greet the registered user with by his name.
$myMail = stripslashes($mail);
$mypassword = stripslashes($password);
$sql ="SELECT * FROM mytable WHERE Email = '$myMail' AND Password='$mypassword'";
$result = mysql_query($sql);
$sql2 ="SELECT Name FROM mytable WHERE Email = '$myMail' AND Password='$mypassword'";
$name = mysql_query($sql2);
No I run through the "array" to find the name according to the email and password
while($rows = mysql_fetch_row($result)){
if($rows['Name'] == $name ){
echo "<h1>Welcome $name </h1>";
}
else{
echo "No Name";
}
}
But the error states:
Notice: Undefined index: Name in C:\Program Files\EasyPHP-5.3.8.1\www\Login.php on line 46
Ok I understand it but the in my table in columns name is "Name" correctly spelled.
Its prob just something small...just need a fresh mind to help me :D
Sorry for the long post.
Kind Regards
Philip