You are using the variable
$row
within your fetch loop but has assigned the
mysqli_fetch_array()
return value to
$result
:
$result = mysqli_query($con, $sql);
while($result = mysqli_fetch_array($result))
The above will also fail when the query fails.
Because a query may fail, you should alse check for that (then
$result
is a boolean as indicated in the error message).
So your code should be
if ($result = mysqli_query($con, $sql)) {
while ($row = mysqli_fetch_array($result)) {
}
}
I can't help regarding the file move problem. For some reason the file
images/bhaji_n_pigtails.jpg does not exist or the directory specified in the
$target
path does not exist. Solving that requires some investigation on your system (PHP and web server setup) and / or debugging.