PHP DOP istruzione Update restituisce true, ma non l'aggiornamento dei DB [chiuso]

0

Domanda

Ho due istruzione update nella mia query, Ma solo uno funziona. Ho provato a commentare il primo che funziona per provare il secondo. Quando ho dd restituisce vero, ma la tabella non è aggiornata. Qualcuno può dirmi cosa devo fare? Grazie

Qui ci sono le query

$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

Migliore risposta

0

La sintassi per il db di aggiornamento è update [dbtable] set field1=xxxx, field2=xxxx where [condition(s)]

Quindi, si prega di cambiare nella tua query di aggiornamento da

SET file_start = ? AND gps_start = ? 

per

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

In altre lingue

Questa pagina è in altre lingue

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