Fetch blob image from table and display it using php sqlite3

前端 未结 1 1772
渐次进展
渐次进展 2021-01-21 23:17

I know this question has been asked many times but I couldnot solve this using any of them. I am new to sqlite and cannot understand what I am doing wrong.

WHAT I AM TR

相关标签:
1条回答
  • 2021-01-22 00:08

    Create an image.php:

    <?php 
    $sql = "SELECT user_profile_picture FROM profile WHERE id = " . $_GET['id'];
    $query = $db->query($sql);
    $row = $query->fetchArray(SQLITE3_ASSOC);
    
    header('Content-Type: image/png');
    echo $row['user_profile_picture'];
    

    In profile.php:

    <img src='image.php?id=<?php echo $row['id'];?>'/>
    
    0 讨论(0)
提交回复
热议问题