mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\OpenServer\domains\mysite3.local\index.php on line 22
из-за чего выдает ошибку?
<html>
<head>
<title>Form to add to cat</title>
</head>
<body>
<form method="post" enctype='multipart/form-data'></p>
<p>IMG <input type='file' name='imagef'></p>
<p><input type="submit" name="addtocat" value="addtocat"></p>
</form>
</body>
</html>
<?php
$addtocat=filter_input(INPUT_POST,"addtocat");
if(isset($_POST['addtocat'])){
$tmp = $_FILES['imagef']['tmp_name'];//код1
$name = $_FILES['imagef']['name'];
$link=mysqli_connect("localhost", "root", "password", "shopdvd");
$query = "SELECT count(1) FROM sdvd_products where img=$name limit 0,1";
$atbarr=mysqli_query($link,$query);
$atbnarr=mysqli_fetch_array($atbarr);//Строка ошибки
$atb=$atbnarr[0];//код1
if($atb==1){
echo "A file with the given name exists";
}elseif($atb==0){
move_uploaded_file($tmp, 'imgs/'.$name);
echo "lsdfafds";
}else{
echo "ucnown error";
}
}