Page 1 of 1

help with posting Pic

Posted: Wed Jan 27, 2010 1:29 pm
by Jfavelle
I am creating a site which shows a picture taken from a database.

Previous images work fine but now the images i'm adding aren't loading

The source for the old ones that work and the new ones that don't is the exact same.

This is the code

Code: Select all

<?php
    // some basic sanity checks
    if(isset($_GET['image_id']) && is_numeric($_GET['image_id'])) {
        //connect to the db
        $link = mysql_connect("localhost", "", "") or die("Could not connect: " . mysql_error());
 
        // select our database
        mysql_select_db("people") or die(mysql_error());
 
        // get the image from the db
        $sql = "SELECT Picture FROM people WHERE ID=" . $_GET['image_id'];
       
        // the result of the query
        $result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
 
        // set the header for the image
        header("Content-type: image/jpeg");
        echo mysql_result($result, 0);
 
        // close the db link
        mysql_close($link);
    }
    else {
        echo 'Please use a real id number';
    }
?>
 
And the code to display the pic
This one doesn't work:

Code: Select all

<img style='float:right' width='80px' height='80px' src='image.php?image_id=70' alt='Photo' />
This one does:

Code: Select all

<img style='float:right' width='80px' height='80px' src='image.php?image_id=131' alt='Photo' />
Any help would be greatly appreciated.

Re: help with posting Pic

Posted: Wed Jan 27, 2010 2:04 pm
by requinix
If you browse to image.php?image_id=70 yourself, what do you see?

Re: help with posting Pic

Posted: Wed Jan 27, 2010 2:18 pm
by Jfavelle
The image doesn't show up when I go the page but the other one does.

I outputted the sql statement to check it from both pages and again they are the exact same.

I was thinking maybe the database was full????

Is there a way to check that

Thanks!

Re: help with posting Pic

Posted: Thu Jan 28, 2010 8:13 am
by Jfavelle
Anyone?

I promise chocalate chip cookies if you can help me!

Re: help with posting Pic

Posted: Thu Jan 28, 2010 8:39 am
by requinix
There is an image #70, right? And it has a JPEG image?