"$img_id" variable does not exist. You have to declare a variable before using it. using it.
You have to store your image id into $img_id variable like: $img_id=5;
Below updated code you can use, i think it will be help of you.
<?php
session_start();
if(isset($_POST['submit']))
{
$db_host='localhost';
$db_username='root';
$db_password="";
$img_id=5;
$con=mysqli_connect($db_host,$db_username,$db_password) or die(mysqli_connect_error());
mysqli_select_db($con, 'food') or die(mysqli_error($con));
$sql="SELECT * FROM tbl_images WHERE img_id='$img_id'";
$result=mysqli_query($con, $sql) or die("Error:" .mysqli_error($con));
$rowcount=mysqli_num_rows($result);
if($rowcount >=1)
{
echo"<script type=\"text/javascript\";
alert('files not uploaded');
window.location=\"login.html\";
</script>";
}
else
{
$sql = "INSERT INTO tbl_images
VALUES('img_id','name','image')";
if(mysqli_query($con, $sql))
{
mysqli_close($con);
header("location:dashboard.php");
}
else
{
echo "Error inserting images";
}
}
}
?>