In your code, $delay
is not the data in the row, but the entire object that represents the results.
You could try to do it in one statement like this however:
update `FlightSchedule` set delay=(SELECT MINUTE (ETA - STA)
FROM `FlightSchedule` WHERE `flightNum_arr`='".$flightNum_arr."');";
Edit:
Try this instead to get around the silly lock that MySQL does :)
update `FlightSchedule` set delay=(select * from (SELECT MINUTE (ETA - STA)
FROM `FlightSchedule` WHERE `flightNum_arr`='".$flightNum_arr."'));";
Edit 2: (aka I should test my queries rther than just scribbling them off the top of my head...)
mysql> select * from updatetest;
+------+------+
| var1 | var2 |
+------+------+
| 450 | 1 |
| 100 | 5 |
+------+------+
2 rows in set (0.00 sec)
mysql> update
updatetest set var2=
(select * from
(select var2 from updatetest where var1=100)
updater);
Query OK, 1 row affected (0.00 sec)
Rows matched: 2 Changed: 1 Warnings: 0
mysql> select * from updatetest;
+------+------+
| var1 | var2 |
+------+------+
| 450 | 5 |
| 100 | 5 |
+------+------+
2 rows in set (0.00 sec)