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 6835491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:14:20+00:00 2026-05-26T23:14:20+00:00

——-EDIT——- hi guys, seeing that you solved this problem for me, i thought it

  • 0

——-EDIT——-
hi guys, seeing that you solved this problem for me, i thought it would be a good idea to solve the same problem again but on a different page. i cannot get the image to show up.

    <?php
$id = $_GET['product_id'];
$query = mysql_query("SELECT * FROM products WHERE serial = '$id'")
or die(mysql_error());  

while($info = mysql_fetch_array($query)) {
echo "";

$name = $info['name'];
$description = $info['description'];
$price = $info['price'];
$picture = $info['picture'];

}
?>

<form action="editsuccess.php?product_id=<?php echo $id; ?>" method="post">

Product ID:<br/>
<input type="text" value="<?php echo $id;?>" name="product_id" disabled/>

<br/>

Name:<br/>
<input type="text" value="<?php echo $name;?>" name="name"/>

<br/>

Description:<br/>
<input type="text" value="<?php echo $description;?>" name="description"/>

<br/>

Price:<br/>
<input type="text" value="<?php echo $price;?>" name="price"/>

<br/>

Picture:<br/>
<? echo'<img src="../getImage.php?id=' . $info['serial'] .'"/>'?> 

</br>

<input type="submit" value="Update Product"/>

</form>

This is a page where an admin can edit a product from a row in a table.
The image is not showing up for some reason.

Thanks for any suggestions.

——EDIT ENDS HERE——–

I still cannot get my PHP image to show up even after following the right method in uploading an image to the database. the following code is for displaying the image:

<form name="form1">
    <input type="hidden" name="productid" />
    <input type="hidden" name="command" />
</form>

    <table border="0" cellpadding="2px" width="600px">
        <?
            $result=mysql_query("select * from products");
            while($row=mysql_fetch_array($result)){

        ?>
        <tr>
            <td><?php '<img src="getImage.php?id=' . $row['serial'] .'"/>'
?>

            </td>
            <td>    <b><a href="products.php?product_id=<?=$row['serial']?>"><?=$row['name']?></a></b><br />
                    <?=$row['description']?><br />
                    Price:<big style="color:green">
                        £<?=$row['price']?></big><br /><br />
                    <input type="button" value="Add to Cart" onclick="addtocart(<?=$row['serial']?>)" />
            </td>
        </tr>
        <tr><td colspan="2"><hr size="1" /></td>
        <? } ?>
    </table>

the getImage.php looks like this:

...
$link = mysql_connect($host, $user, $passwd);
mysql_select_db($dbName);
$query = 'SELECT picture FROM products WHERE serial="' . $_GET['id'] . '"';
$result = mysql_query($query,$link);
$row = mysql_fetch_assoc($result);
echo $row['picture'];
?>

only the name, description and price is showing up on the webpage. my MySQL table looks like this:

  • serial
  • name
  • description
  • price
  • picture (blob)
  • 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-26T23:14:21+00:00Added an answer on May 26, 2026 at 11:14 pm

    You are not setting the correct Content-type header before echoing out the image data.

    You MUST also escape the $_GET['id'] parameter.

    // Escape $id
    $id = mysql_real_escape_string($_GET['id']);   
    
    $link = mysql_connect($host, $user, $passwd);
    mysql_select_db($dbName);
    
    // Use the escaped $id
    $query = "SELECT picture FROM products WHERE serial='$id'";
    $result = mysql_query($query,$link);
    
    if ($result) {
      $row = mysql_fetch_assoc($result);
    
      // Set the Content-type
      // This assumes image/jpeg. If you have different image types,
      // you'll need logic to supply the correct MIME type
      // image/jpeg image/png image/gif, etc
      header("Content-type: image/jpeg");
      echo $row['picture'];
    }
    ?>
    

    In your main script, it looks like you are merely missing an echo

            <td><?php '<img src="getImage.php?id=' . $row['serial'] .'"/>'
            // Should be
            <td><?php echo '<img src="getImage.php?id=' . $row['serial'] .'"/>'
            // ------^^^^^^
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently ran against a very interesting site that expresses a very interesting idea
I'm including a local class that requests a file from a remote server. This
I'm trying to create a chrome extension and im doing this by parsing an
I have set of xml elements like this: <item code=<HTML_CODE> /> For example: <items>
My app uses a WebRequest at certain points to get pages from itself. This
This is a follow-up to the question: Should the folders in a solution match
I am currently running into a problem where an element is coming back from
&mdash; or &#8212; Is there a difference between these? Is one better-supported than the
Any idea whats the difference between the two commands below? Command: manage.py runfcgi method=threaded
I'm currently working on a little harvester, using this dataset of 2700 foundations .

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.