I use PHP and MySQL.
MySQL will not update the last cell in my table. I can’t understand why.
Basically, I am doing 10 INSERT with a foreach () loop in an array. In each loop, I use the following code:
$sql = "INSERT INTO table1 (name, address, phone, date_time, process_started, process_ended) VALUES ('$name', '$address', '$phone', NOW(), 'started', '')"; $result = @mysql_query($sql, $con) or die(mysql_error());
This works great; all data is inserted into the table.
Then, when I return to update the "process_ended" field, it only updates the penalty for the first 9 lines. But it will not update the cell "process_ended" from the 10th row.
Here is the code to update. It does not use a loop; I just typed it in a script 10 times.
$sql = "UPDATE table1 SET process_ended = 'ended' WHERE name = '$name' && address = '$address'"; $result = @mysql_query($sql, $con) or die(mysql_error());
I checked that the name and address cells match what is in the script; and they do it. I also checked three times to make sure there were no typos in my scripts.
I think this is due to MySQL, because when I switch the order of updates, it is always the last cell that is not updated. I deleted the table and redid it, and I also hit the DB restore button in cPanel, and it says that this is normal.