PHP: Retrieve image from MySQL using PDO

后端 未结 4 1808
误落风尘
误落风尘 2020-12-06 22:38

I am refactoring some old code, including rewriting basic mysql queries to use PDO.

The following works brilliantly in all browsers and for all image types:

4条回答
  •  情深已故
    2020-12-06 22:55

    This code displays all the images in the dabase so you can change it and make it do what you want it to do

    getMessage(); } ?>
     prepare($query);
    $image_show->execute();
    while($record =$image_show->fetch(PDO::FETCH_ASSOC)) {
    #this is the Tannery  operator to replace a pic when an id do not have one
    $photo = ($record['image_name']== null)? "me.png":$record['image_name'];
    #display image 
    echo '';
    echo $record['user_id'];
    }
    ?>
    

提交回复
热议问题