<?php $host = "localhost"; $username = "root"; $password = "vladon12"; $db_name = "cdcol"; $tbl_name = "members"; mysql_connect($host, $username, $password) or die("can't connect"); mysql_select_db($db_name) or die(mysql_error()); $username = $_POST['username']; $password = $_POST['password']; $sql = "SELECT * FROM $tbl_name WHERE username='$username' and password='$password'"; $result = mysql_query($sql); $count = mysql_num_rows($result); if($count==1) { session_register("username"); session_register("password"); header("location:login_success.php"); } else{ echo "Неверный Логин или Пароль"; } ?> Here's what's wrong here, it writes me "Invalid Login or Password" Even if the password and Login are correct, what should I do? Thank you in advance)
$count = mysql_num_rows($result);dodie(var_dump($count, mysql_fetch_array($result), $username, $password, mysql_error()));what will lead out? - Sh4dow$sql = "SELECT * FROM $tbl_name WHERE username='$username' and password='$password'";- never do that. And in general, do not do necrophilia withmysql_*(they are already deprecated) - take, finally, PDO. Or PEAR :: DB, at worst. - drdaeman