You have many errors in your code :
$result = mysql_query("SELECT * FROM utilizatori WHERE username="" . $loginUsername . "" and parola="". $loginUsername.""");
You check username and parola on same var.
You probably want :
$result = mysql_query("SELECT * FROM utilizatori WHERE username="" . $loginUsername . "" and parola="". $loginPassword.""");
You are also affecting vars without quotes :
$_SESSION["userid"] = $row['id'];
Check also this :
- json_encode() to send your message in JSON instead of writing it yourself
- mysqli_* or PDO cause you’re using mysql_* which is deprecated
- mysql injections in your query
4
solved Login PHP it’s not working [closed]