Database getting updated twice

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hey all,

Another question for you.

I have a script that reads in a row from my db into an image object
which i defined. It then takes that image and generates a thumbnail by
using an output buffer and writes the thumbnail to a new entry in the
database. Finally it prints the new image to the screen via this

header("Content-type: ".$image->GetFileType());
header("Content-length: ".$this->GetFileSize());
echo $this->GetImageContent();

where GetImageContent returns the binary data contained in the image.

This all seems to work, but when it hits the first header line
header("Content-type: ".$image->GetFileType());

it adds a second entry into the database. Basically im ending up with 2
identical records.

Ive been trying to figure out how to work around this, and the only
thing i could think of was that because im calling to header the script
is getting executed twice. No where in my print function so i have a
call to save so my question i suppose is, is it possible for a script
to execute a second time because of a call to header?

Re: Database getting updated twice

Areric wrote:
Quoted text here. Click to load it

So, what does your GetFileType() function do?

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: Database getting updated twice

just returns $this->mFileType; where mFileType is a string value along
the lines of "image/jpeg"

Site Timeline