0

I have to show image from database path. So I prepared the php code. Problem is : I does not show any images more over It shows the message:

Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'a INNER JOIN advt b ON a.ad_name=b.ad_name WHE' at line 9' in ...

Php code:

<?php 
    include('include/config.php');

    if($stmt = $connection->prepare("SELECT 
                                     a.img_id, 
                                     a.ad_name, 
                                     a.img_name, 
                                     a.img_type, 
                                     a.img_size, 
                                     b.ad_id, 
                                     b.cus_id 
                                     FROM full texts a 
                                     INNER JOIN advt b
                                     ON a.ad_name=b.ad_name
                                     WHERE ad_name = ?")){ 

           $stmt->bind_param("s",$ad_name);
           $stmt->execute(); 
           $stmt->store_result(); 
           $stmt->bind_result($img_id, $ad_name, $img_name, $img_type, $img_size, $ad_id, $cus_id);   

           while($stmt->fetch()){ 

              echo  "<img src=ad/data/img/$cus_id/$ad_id/$img_name  width='220' height='220'><br>";


           } 
           $stmt2->close();
           } 

?>

I have two tables in database: 1st Table: advt

- ad_id
- cus_id
- ad_name
- ad_des
- date

2nd table : Full texts

- img_id
- ad_name
- img_name (type: longblob)
- img_type
- img_size

I am unable find out where the problem is. Plz help.

WillardSolutions
  • 2,316
  • 4
  • 28
  • 38
dipak dutta
  • 274
  • 2
  • 13

0 Answers0