Can't Update Please I need help


#41

It is strange. Maybe again it’s to get to the latest comments without having to extract all transactions and display the last one. Seems wasteful given the speed with which a modern db server would do that, and plenty of scope for them going out of sync.

No, I read the second table as just being a “snapshot” of the current status of the delivery (or whatever it is we’re looking at). So there would only ever be one of those, hence the update, or insert when the job is first created. Maybe the OP will confirm or deny this is how they relate.


#42

I found a way to update the comments through phpMyAdmin under tbl_courier, let me manage this way for the now


#43

I know this is in the PHP category but I wonder if this is more of a Database thing.

Specifically, instead of an INSERT followed by an UPDATE, wouldn’t using a TRIGGER be an improvement?

https://www.sitepoint.com/database-triggers-events/

https://www.sitepoint.com/how-to-create-mysql-triggers/

But maybe I’m not seeing something and what is needed is a transaction?

https://www.sitepoint.com/mysql-transactions-php-emulation/


#44

I’m only guessing that’s what the separate table is for, I was hoping the OP would confirm. In any case, without the table layout it’s difficult to offer any more suggestions. I can’t see that having to go in to edit the row via phpmyadmin is much of a solution to anything, myself.


#45

Why use “INSERT” when you are trying to update?