At 10:41 +0100 9/24/02, Jon Wyatt wrote:
>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.

"DESC" is a keyword.

>  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.

Reply via email to