Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6791729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:52:54+00:00 2026-05-26T17:52:54+00:00

So I was implementing a sponsorship admin website then I encountered some trouble around.I

  • 0

So I was implementing a sponsorship admin website then I encountered some trouble around.I am aware that storing image into database could be such pain in the neck but this is required(having a filesystem to store images in the campus server is prohibited).

I create 3 tables:

  • a info table storing text information,
  • an image table storing images in BLOB fashion and
  • a id_table table as a reference table keeping records of image id and info id.
$result=mysql_query("SELECT info_id,info_name,info_year,info_level,info_email,info_describe FROM info");
while($row = mysql_fetch_array($result))
{
    echo "<td>" . $row['info_name'] . "</td>";
    echo "<td>" . $row['info_year'] . "</td>";
    echo "<td>" . $row['info_level' ] . "</td>";
    echo "<td>" . $row['info_email'] . "</td>";
    echo "<td>" . $row['info_describe'] . "</td>";
    $result_image_id = mysql_query("SELECT id_image FROM id_table WHERE id_info = '{$row['info_id']}'");
    $row_image = mysql_fetch_array($result_image_id);
    $result_image = mysql_query("SELECT image_stuff FROM image WHERE image_id = '{$row_image['id_image']}'");
    $row_2 = mysql_fetch_array($result_image);
    $content=$row_2['image_stuff'];
    echo "<td>" ;
    header('Content-type: image/jpeg');
    echo $content;
    echo "</td>";
    echo "</tr>";
}

Then in the browser, I was redirected to a blank page. If I delete that header function, I do have a table in the page but there is nothing in the image column.

Any suggestions ?

Additionally, I tried using an <img> tag in my while loop:

echo "<img src='$content' />";

The good news is, it kind of worked out but the image file did not display practically.

I had a table in my page with image column filled with image files, but it looked just like the server did not find the image though.

I guess there does not exist any problem with my insert script because when I was applying that img tag,the “cannot display” logo only appeared in the cell whose row is the one I did upload image file into database…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:52:55+00:00Added an answer on May 26, 2026 at 5:52 pm

    You cant use headers like that…

    try something like that

    $result=mysql_query("SELECT info_id,info_name,info_year,info_level,info_email,info_describe FROM info");
    while($row = mysql_fetch_array($result))
    {
    echo "<td>" . $row['info_name'] . "</td>";
    echo "<td>" . $row['info_year'] . "</td>";
    echo "<td>" . $row['info_level' ] . "</td>";
    echo "<td>" . $row['info_email'] . "</td>";
    echo "<td>" . $row['info_describe'] . "</td>";
    $result_image_id = mysql_query("SELECT id_image FROM id_table WHERE id_info = '{$row['info_id']}'");
    $row_image = mysql_fetch_array($result_image_id);
    $result_image = mysql_query("SELECT image_stuff FROM image WHERE image_id = '{$row_image['id_image']}'");
    $row_2 = mysql_fetch_array($result_image);
    $content=$row_2['image_stuff'];
    echo "<td>" ;
    echo '<img src="data:image/png;base64,' . base64_encode($content) . '" />';
    echo "</td>";
    echo "</tr>";
    }
    

    Change the png for whatever type of image you stored. I havent looked at the code much but this should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im Implementing a video broadcasting website. For that I planned to use silverlight player
While implementing my own IFilter I found that most likely some consumers will require
Implementing the very first scala example I ran into some problems probably tipical for
Implementing a custom membership provider, there are certain properties such as MinRequiredPasswordLength that only
When implementing the Strategy Pattern, where does one put the code that determines which
Does implementing the Zend Framework require the existing MySQL database to be modified? If
Implementing a Thread by providing a new class that extends Thread and overriding its
Implementing a web service that uses Transport-level security with WCF over HTTP is pretty
The implementing-result-paging-in-hibernate-getting-total-number-of-rows question trigger another question for me, about some implementation concern : Now
I implementing OLE DB provider for my custom database. It will be used from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.