我有一个select
查询没有从数据库中提取。我知道连接正常,因为我有一个insert
查询可以正常工作。我知道我的查询失败了,因为它显示了我的其他声明。
我做错了什么?
$con = mysqli_connect($DB_HOST,$DB_USER,$DB_PASSWORD,$DB_DATABASE);
if(!$con){
echo "Connection Error...".mysqli_connect_error();
}
else
{
echo "<h3>Database connection Success...</h3>";
}
$user_name = $_POST["login_name"];
$user_pass = $_POST["login_pass"];
$sql_query = "select name from user_info where user_name like '$user_name'
and user_pass like '$user_pass';";
$result = mysqli_query($con,$sql_query);
if ( $result == false ) {
echo mysqli_error($con); exit;
}
if(mysqli_num_rows($result) >0 )
{
$row = mysqli_fetch_assoc($result);
$name =$row["name"];
echo "Login Success..Welcome ".$name;
}
else
{
echo "Login Failed.......Try Again..";
}
?>