PHP PDO ปรับปรุงแถลงการณ์จะได้ค่าเป็นจริงแต่ไม่ได้กำลังปรับปรุง 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

ครูปแบบการสั่งงานสำหรับ db กำลังปรับปรุงคือ update [dbtable] set field1=xxxx, field2=xxxx where [condition(s)]

นี่แหละ,ได้โปรดเปลี่ยนแปลงของคุณปรับปรุงจาก query

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ý
..................................................................................................................

ดังอยู่ในนี้หมวดหมู่

ดังคำถามอยู่ในนี้หมวดหมู่