我的数据库开发人员让我使用SQL表中的字段作为图像类型。 我试图把图像有人上传,只是将其插入在php中为图像写入插入语句
$imagePath = Input::file('image');
$image = $imagePath->getPathName();
$图像返回临时路径名
$file = fopen($image, "rb");
$content = fread($file, filesize($image));
fclose($file);
$SqlConn = "INSERT INTO [poll14] ([image]) VALUES ($content)";
但我得到这个错误:发生错误代替命名参数。 我该如何插入数据?
' “INSERT INTO poll14(图)VALUES( '$内容')”' – JustOnUnderMillions
您还需要了解,理解并开始使用参数化查询。你在这里有什么是开放的SQL注入。 –