I am trying to use the following code to insert data into a mysql database:-


# write the information to the database
$sth=$dbh->prepare("INSERT INTO images(name,desc,category,subcat1,subcat2,image) 
VALUES(?,?,?,?,?,?)");

$sth->bind_param(1,$name);
$sth->bind_param(2,$desc);
$sth->bind_param(3,$category);
$sth->bind_param(4,$subcat1);
$sth->bind_param(5,$subcat2);
$sth->bind_param(6,$photo);

$sth->execute;


I get syntax error in sql statement. The image field is a blob so I'm not sure if a 
string is the correct format but from the manual it appears that DBI only understands 
string or number formats. The photo variable holds the binary data.

The format above as far as I can tell conforms to the standard DBI format but the 
DBD::mysql man page is not particularly explicit in this area.

Thanks.

Jon.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.385 / Virus Database: 217 - Release Date: 04/09/2002

Reply via email to