1

This is my php file.

        $con=mysql_connect("localhost","root","");
        mysql_select_db("food",$con);

         $SQL = "SELECT image FROM info WHERE Type='Fruit Pizza' ";
         $RESULT = mysql_query("$SQL");


        $ROW = mysql_fetch_assoc($RESULT);

          header("Content-type: image/png");
          echo $ROW['image'];

    ?>

This is how i add the image into database.

 $data = addslashes(file_get_contents('dinner2.png'));

mysql_query("INSERT INTO info(image, Name, Price, type) VALUES('$data','Fruit Pizza','8', 'png')");

Is there anything wrong with my code?? The problem is everytime i try to retrieve the image it show a small grey box instead of the picture.Anyone can help??

ron
  • 41
  • 7

0 Answers0