数据库中的图像上传查询

时间:2015-10-25 16:14:35

标签: php

我正在使用以下sql查询将图像上传到数据库...

$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()); 

但得到和错误:

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/25-10-201' at line 1

任何人都可以帮我解决这个问题吗?

2 个答案:

答案 0 :(得分:0)

mysql中的表格使用反引号而不是引号进行转义。所以请改用它:

main

另见Should I use backticks or not when escaping keywords in MySQL?

答案 1 :(得分:0)

试试这个:

config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
  :address => "smtp.gmail.com",
  :port => 587,
  :domain => 'smtp.gmail.com',
  :user_name => "username@gmail.com",
  :password => "yourpassword",
  :authentication => :login,
  :enable_starttls_auto => true
} 

用反引号包围的表和列名称`不是单个qoute'