【发布时间】:2014-09-11 17:02:12
【问题描述】:
我正在尝试将复制图像插入文件夹并将图像路径保存到 SQL 表。我使用以下代码将图像存储在文件夹和数据库路径中。当我运行代码图像被复制但图像的路径没有存储在数据库中。
if(move_uploaded_file($temp_name, $target_path)) {
$query_upload="INSERT into 'images_tbl' ('images_path','submission_date') VALUES('".$target_path."','".date("Y-m-d")."')";
mysql_query($query_upload) or die("error in $query_upload == ----> ".mysql_error());
当我运行它时,我得到以下错误
error in INSERT into 'images_tbl' ('images_path','submission_date') VALUES ('images/21-07-2014-1405927802.png','2014-07-21') == ----> 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 ''images_tbl' ('images_path','submission_date') VALUES ('images/21-07-2014-14' at line 1
【问题讨论】:
-
尝试删除表和字段名称上的简单引号
'。
标签: php sql database image upload