一直盯着这一天,似乎无法弄清楚为什么我的更新语句无法更新字段'image_filename':
$fileName = $_FILES['image_filename'];
if($fileName["name"] <> ""){
$imageFile = $fileName['name'];
$destination = "../../../../assets/resources/images/".$fileName['name'];
move_uploaded_file($fileName['name'], $destination);
}
$updateSQL = sprintf("UPDATE content SET image_filename='$imageFile' WHERE id=%s",
GetSQLValueString($_POST['resource_id'], "int"));
mysql_select_db($database_conn_talent, $conn_talent);
$Result1 = mysql_query($updateSQL, $conn_talent) or die(mysql_error());
SQL专业人员可以告诉我我错过了什么吗?非常感谢您的反馈!
答案 0 :(得分:0)
您似乎正在构建查询,但从不执行它。另外,Drupal会为你处理所有sprintf
,如果你愿意的话。
$query = "UPDATE content SET image_filename='$imageFile' WHERE id=%i";
db_query($query, $_POST['resource_id']);