Store image data type using PHP
I have an SQL Server database with following table.
Table PROMO, column:- code , varchar(10)
- name开发者_JAVA技巧 , varchar(10)
- image_data, image
- desc , text
How do I insert an image file as a binary into SQL Server using PHP PDO? The image will be stored in column image_data.
What type of variable should I pass to the PDO parameter?
$stmt = $conn->prepare($query, array(
':code' => $code,
':name' => $name,
':image_data' => $imageData,
':desc' => $desc
));
Exactly the same way as you store any other data, text for example. There is no difference.
精彩评论