Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Kal
    Kal is offline
    Regular Coder
    Join Date
    Dec 2005
    Posts
    309
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Retrive image from mysql database, slight problem

    Hi,

    i kept at my problem at trying to display an image from the database, i've manged to achieve my target, with the following:-

    //main.php
    <img '.$row['image_size'].' src="view_image.php?image_name='.$_GET['image_name'].'"></td>

    //view_image.php
    <?php

    require ('database.php');

    // get the image from the db
    $sql1 = "SELECT img_data,image_name FROM manufact_img.thumb_images WHERE image_name = 'S320.jpg'";

    // the result of the query
    $result1 = mysql_query("$sql1") or die("Invalid query: " . mysql_error());

    // set the header for the image
    header("Content-type: image/jpg");
    echo mysql_result($result1, 0);

    ?>

    however as you can see the image name is hard coded (view_image.php), on the main.php file i have a query which displays a specific image name, i want this to replace the hard coded value, any ideas.

    but without using a submit button.

    any help would be great

    thanks in advance.
    Last edited by Kal; 02-16-2006 at 11:06 AM. Reason: Got half of it working, still unsure about something else


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •