Re: Re: php mysql blob fields

From: Date: Wed, 21 Nov 2001 20:50:55 +0000
Subject: Re: Re: php mysql blob fields
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-75446@lists.php.net to get a copy of this message
Yes, that's a big one :) also, to save the headache of reading and escaping the image correctly you can let mysql do the work: update table set field=LOAD_FILE('/path/to/image.gif'); On Wed, 21 Nov 2001 12:16:47 -0800, Fred wrote: >If insert works and update does not, I would guess it is because you >spelled >the table name wrong in the update query. > >Fred > >Rodrigo Peres <rperes@mac.com> wrote in message >news:B82193DA.603D%rperes@mac.com... >> Hi, >> >> I have a table in mysql that stores some images my fields in this >>table >are: >> ImageID,Image_Name, Image_Size, Image_Type, Image_Data (this is >>the blob). >> The problem is, when i insert a new image everything goes fine, >>but I >can't >> update it!!! Why? >> to insert I'm using this >> >> if($image != "none") { >> $image_bd = >>addslashes(fread(fopen($imagem,"r"),filesize($imagem))); >> $sql = "INSERT INTO >> images(ImageID,Image_Name,Image_Size,Image_Type,Image_Data) >> >>VALUES('','$imagem_name','$imagem_size','$imagem_type','$imagem_bd') >>"; >> $query->executa($sql); >> } >> >> and to update: >> >> if($imagem != 'none') { >> $Image_bd = >>addslashes(fread(fopen($imagem,"r"),filesize($imagem))); >> $sql = "UPDATE imagens SET >> >Image_Name='$imagem_name',Image_Size='$imagem_size',Image_Type='$imag >em_type >> ',Image_Data='$image_bd' WHERE ImageID='$ImageID'"; >> $query->executa($sql); >> } >> >> Why I cant' update?? >> >> Thank's in advance >> >> Rodrigo >> -- >> >> > > >

« previous php.general (#75446) next »