This question already has an answer here:
I have a code like below:
$sql="SELECT * FROM $tbl_name WHERE AdminId='$AdminId'";
$result=mysqli_query($conn,$sql);
$row = mysqli_fetch_assoc($result);
and $conn
is declared like below in a separate connection file:
<?php
$host="1.2.3.4:1234"; // Host name
$username="xyz"; // Mysql username
$password="abc"; // Mysql password
$db_name="dbname"; // Database name
$conn=@mysqli_connect("$host", "$username", "$password")or die("Cannot connect to the server");
mysqli_select_db($conn,"$db_name")or die("Cannot select DB");
?>
While running the php page, I am getting below error:
mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given
While, this query works fine with my localhost.
Any suggestion ?
Thanks.
</div>