PHP一项旨在更新声明返回的真实的,但不更新DB[封闭]

0

的问题

我有两个声明更新在我的查询,但只有一个工程。 我想评论的第一个工作尝试的第一个。 当我 dd 这回是真的,但该表并不会更新。 可以有人告诉我我应该怎么做? 感谢

这里是查询

$q = "UPDATE data_file SET 
file_name=?,file_size=?
WHERE module_id = ". $this->module_id;
   
$date = date('Y-m-d H:i:s');
 
$updateStmt = $this->conn->prepare($q);
$updateStmt->execute([
    $this->file_name,
    $this->file_size,
]);
  
//this query returns true but not updating the database
$q1 = "UPDATE server_status SET file_start = ? AND gps_start = ? WHERE module_id = ". $this->module_id;
$updateStmnt2 = $this->conn->prepare($q1);
$stat = $updateStmnt2->execute([
    1,
    $date
]);
//query 2 end

Responses::http_ok();
mysql pdo php
2021-11-24 05:18:01
1

最好的答案

0

法数据库更新 update [dbtable] set field1=xxxx, field2=xxxx where [condition(s)]

因此,请的变化更新的查询

SET file_start = ? AND gps_start = ? 

SET file_start = ? , gps_start = ?
2021-11-24 07:46:13

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................