<?php
require "config.php";
if($stmt = $mysqli -> prepare("SELECT * FROM donorregistration WHERE Email=? and Password=?"))
{
$email=$_POST['donorEmail'];
$password=$_POST['password'];
$stmt -> bind_param("ss",$email,$password);
$stmt -> execute();
$stmt->store_result();
if($stmt->num_rows!=1)
{
echo "Sorry, Your E-mail ID or Password is incorrect";
}
else
{
}
}
$mysqli -> close();
?>
我不知道在else部分写什么。我想打印名为&#34; Account_Number&#34;的列。和列#34;名称&#34;来自mysql数据库。请帮帮我。
答案 0 :(得分:0)
使用 fetch 和 bind_result 语句检索数据
请尝试以下
<?php
require "config.php";
if($stmt = $mysqli -> prepare("SELECT * FROM donorregistration WHERE Email=? and Password=?"))
{
$email=$_POST['donorEmail'];
$password=$_POST['password'];
$stmt -> bind_param("ss",$email,$password);
$stmt -> execute();
$stmt->store_result();
$stmt->bind_result($email,$pass);
$stmt->fetch();
if($stmt->num_rows!=1)
{
echo "Sorry, Your E-mail ID or Password is incorrect";
}
else
{
//retrieved
echo "Your email is $email and pass $pass");
}
}
$mysqli -> close();
&GT;