I am trying to pass a variable to a mysqli query as shown below but it never updates the record
This works:
mysql> UPDATE zeus.alldata SET A='56.1' WHERE wwxRecord =
(SELECT max(dateTime) FROM wwx.wmx_archive);
Query OK, 1 row affected (0.17 sec)
Rows matched: 1 Changed: 1 Warnings: 0
This does not:
$A = "56.1";
$sql = mysqli_query($conn,"UPDATE ".$template_db.".alldata SET A='$A'
WHERE wwxRecord = (SELECT max(dateTime) FROM ".$wwx_db.".wmx_archive");
This does not:
$A = "56.1";
$sql = mysqli_query($conn,"UPDATE ".$template_db.".alldata SET A=".$A."
WHERE wwxRecord = (SELECT max(dateTime) FROM ".$wwx_db.".wmx_archive");
Using an echo $A; right before and after the statement show the correct 56.1, but nothing I seem to try allows me to pass the $A to the query. The other variables work fine (".$template_db.") as I use them throughout the script for other database updates.
I hope I am just missing something simple!
if ( !$sql ) trigger_error( mysqli_errno($conn) . ' '. mysqli_error($conn), E_USER_ERROR);What does that print?