http://www.youtube.com/watch?v=4oSCuEtxRK8 part one!
http://www.youtube.com/watch?v=y7ae_cZahPs part two!
and im stuck at part 2 part one works fine with me...
i didnt wanted to write the code as he did, can someone explain me why this code doesnt work???? (THIS IS MY CODE I MODIFIED THE TUTORS CODE FROM PART 2)
Code: Select all
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if ($username&&$password)//proverava da si su vrednosti iz index.php prebacene u promenjive na ovoj strani
{
$connect = mysql_connect("localhost","root","") or die("Logovanje na sistem nije uspesno");
mysql_select_db("vezba") or die ("Baza sa tim imenom nije pronadjena");//mysql select db je built in function zato se ne deklarise
$query = mysql_query("SELECT * FROM * user WHERE username='$username'");
$dbusername = $query['username'];
if ($username==$dbusername)
{
echo "Ur logged in";
}
else die ("Inncorect user or password!");
}
else die ("Must fill in form");
?>username from the database in the PHP VARIABLE and then to try to match the PHP VARIABLES . if variable 1 == variable 2 , echo you are logged in. can someone explain me how to achieve this. p.s this dude in his tutorials uses the rows to find out if user is in database or not, and i perssonaly didnt liked that method. thanks guys.