繁体   English   中英

使用PHP从MySQL数据行将图像Blob插入mysql数据库

[英]Insert image blob into mysql database from a mysql data row using PHP

我正在使用以下插入语句将从一个数据库读取的Blob行插入另一个数据库。 (当我回显相同的插入语句时有数据)。

更新:

"INSERT INTO co_registration_picture_evidence_blb
        (_URI, _CREATOR_URI_USER, _CREATION_DATE, _LAST_UPDATE_URI_USER, _LAST_UPDATE_DATE, 
        _TOP_LEVEL_AURI, VALUE) VALUES('".$imageRow['_URI']."','".$imageRow['_CREATOR_URI_USER']."','"
        .$imageRow['_CREATION_DATE']."','".$imageRow['_LAST_UPDATE_URI_USER']."','".
        $imageRow['_LAST_UPDATE_DATE']."','".$imageRow['_TOP_LEVEL_AURI']."'".
        $imageRow['VALUE']."')"

我收到以下错误消息。

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

更新:现在我得到这个错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?PNG\r\n\Z\n\0\0\0\rIHDR\0\0\0?\0\0\0?\0\0\0????\0\0%iCCPICC Profile\0\0x??M' at line 3

谁能告诉我语法有什么问题吗? 我的猜测是我应该将LongBlob类型的VALUE列(包含图像)包装到某些编码功能。 (所有数据字段均已通过mysql_real_escape_string()过滤)。

任何输入将不胜感激。

问候。

您似乎想念一个, '

INSERT INTO co_registration_picture_evidence_blb
        (_URI, _CREATOR_URI_USER, _CREATION_DATE, _LAST_UPDATE_URI_USER, _LAST_UPDATE_DATE, 
        _TOP_LEVEL_AURI, VALUE) VALUES('".$imageRow['_URI']."','".$imageRow['_CREATOR_URI_USER']."','"
        .$imageRow['_CREATION_DATE']."','".$imageRow['_LAST_UPDATE_URI_USER']."','".
        $imageRow['_LAST_UPDATE_DATE']."','".$imageRow['_TOP_LEVEL_AURI']."', '".
        $imageRow['VALUE']."')

我有什么改变?

'".$imageRow['_TOP_LEVEL_AURI']."'".

'".$imageRow['_TOP_LEVEL_AURI']."', '".

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM