This question already has an answer here:
Please help. I get this errors :
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in
This is my php file
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
$image = $_POST['image'];
$name = $_POST['name'];
require_once('dbConnect.php');
$sql ="SELECT id FROM uploads ORDER BY id ASC";
$res = mysqli_query($con,$sql);
$id = 0;
while($row = mysqli_fetch_array($res)){
$id = $row['id'];
}
$path = "uploads/$id.png";
$actualpath = "http://www.fikri.hol.es/$path";
$sql = "INSERT INTO uploads (image,name) VALUES ('$actualpath','$name')";
if(mysqli_query($con,$sql)){
file_put_contents($path,base64_decode($image));
echo "Successfully Uploaded";
}
mysqli_close($con);
}else{
echo "Error";
}
?>
Thanks
Aucun commentaire:
Enregistrer un commentaire