I am trying to display image and details from database where i have stored. I have got code which connects to database but doesn't fetch. Edited: Thanks guys i was able to fetch but I have incurred anther problem. I have stored image as blob. so when i queried it displayed some mumbojumbo language. screenshot of the result screenshot of how i stored image ....... echo"Connected to db" ;
if (isset($_POST['info'])){
$info= 'info';
if ($info== 1){
$sql= "SELECT name,img,price FROM product WHERE price<400";
$result=mysqli_query($conn,$sql);
while ($row = mysqli_fetch_assoc($result)){
echo "<div class= 'row'>";
echo "<div class = 'col-sm-3'>";
echo "<p>".$row['img']."</p><br/>";
echo "<h3>".$row['name']."</h3><br/>";
echo "<h4>£".$row['price']."</h4><br/>";
echo "</div>";
echo "</div>";
}
}
exit();
Here is my jquery code where it prints the the output of checkbox and it echo connected to database but can't fetch.
$(".id_price").each(function() {
if ($(this).is(":checked")) {
var check = $(this).val();
console.log(check);
$.post('database.php',{info:check},function(response){
$(".product").html(response).show();
});
}
});