Answer the question
In order to leave comments, you need to log in
Why is 0 rows returned from sql query?
I enter the login and password that matches the database
<form method="POST" action="login.php">
<input type="text" name="login" size="15">
$conn = mysqli_connect("localhost","my_user","sMtWzj6WLNFkrQCa","users");
if ($conn == false){
print("Ошибка: Невозможно подключиться к MySQL ".mysqli_connect_error());
}
mysqli_set_charset($conn, "utf8");
}
$qu = "SELECT * FROM data WHERE 'login'='". $_POST["login"] ."' AND 'pass'='". $_POST["pass"]."'";
$zapros =mysqli_query($conn,$qu);
if($result = mysqli_query($conn,$qu)){
$rowcount=mysqli_num_rows($result);
printf("Result set has %d rows.\n",$rowcount);
Answer the question
In order to leave comments, you need to log in
This code contains a SQL Injection vulnerability that is easy to exploit. Read about PDO and Prepared Statements and don't embarrass yourself like that anymore.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question