help with posting Pic

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jfavelle
Forum Newbie
Posts: 8
Joined: Wed Jan 27, 2010 1:24 pm

help with posting Pic

Post 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.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: help with posting Pic

Post by requinix »

If you browse to image.php?image_id=70 yourself, what do you see?
Jfavelle
Forum Newbie
Posts: 8
Joined: Wed Jan 27, 2010 1:24 pm

Re: help with posting Pic

Post 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!
Jfavelle
Forum Newbie
Posts: 8
Joined: Wed Jan 27, 2010 1:24 pm

Re: help with posting Pic

Post by Jfavelle »

Anyone?

I promise chocalate chip cookies if you can help me!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: help with posting Pic

Post by requinix »

There is an image #70, right? And it has a JPEG image?
Post Reply