List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 2 1999 5:56pm
Subject:Re: How-to insert BLOB with INSERT Statements
View as plain text  
At 5:51 PM +0100 12/2/99, Tobias Bulla wrote:
>Hi all...
>I have a problem with blob fields. My Provider has several security 
>restrictions for his MySQL server. My only way to interact with my 
>database on this server is through the use of PHP3 script on my 
>webspace on his server. Now the problem: I want to upload a blob 
>field wich contains a gif picture. The LOAD DATA INTO FILE Statement 
>doesn't work. I think this is another restriction of my provider. I 
>tried it with the following Statement:
>INSERT IGNORE INTO table_name VALUES ( value_list )
>The value_list contains several data, each enclosed by ' and 
>seperated by , . The gif, one of the data fields contains several 
>special character, wich are misinterpreted by MySQL. I have replaced 
>any ' sign with \' , but there seem to be some more special signs. 
>Is there any other way to upload a gif into the database through the 
>use of SQL Commands?

Sure.  Try encoding each value to be inserted with htmlentities() 
first.  You should
be doing this anyway for queries that you construct in a PHP script.  Note that
you still need to add the quotes around the column values. 
htmlentities() doesn't
do it for you, unlike the DBI quote() method.

Paul DuBois, paul@stripped
How-to insert BLOB with INSERT StatementsTobias Bulla2 Dec
  • Re: How-to insert BLOB with INSERT StatementsPaul DuBois2 Dec