我希望这段代码检查表单登录是否$name在$password数据库中,如果是,则显示,echo "Hello ".$name;如果不是echo "You are not in database";,但问题是它总是显示真相。
感谢您的回答,抱歉我的英语)
include "db.php";
$db = db();
/*print_r($db);*/
$name = $_POST["name"];
$password = $_POST["password"];
$qur = "SELECT * FROM login WHERE name ='".$name."' AND password = '".$password."'";
$data_from_table = $db->query($qur);
if($data_from_table == true)
{
echo "Hello ".$name;
}
else
{
echo "You are not in database";
}
呼唤远方
千巷猫影
饮歌长啸