Hello,I have added code on Row Inserting of Table A to add a corresponding entry in Table B. Insert query works well for Table B, but now I also need to have the ID of the row inserted in Table B. None of the Execute functions seem to return the ID of the last row inserted. I tried to execute the select query with Max(ID) on Table B, but somehow it is not returning the correct value.How to handle this situation? What’s the best way to get it done? I’m using PHPMaker 2021.Waiting for your valuable reply…Thanks!/r
Is the ID in table B an auto increment field?
Yes. It is Primary Key, Auto increment field in Table B.
You may search for lastInsertId keyword in this forum.
Great! You solved my problem. Thanks so much!!Just for the records, I added following two lines to my code after ExecuteUpdate function to get the index of last row inserted.
$conn = $this->getConnection();
$uid = $conn->lastInsertId();
I saw you mentioning ExecuteStatement function for Insert query. I checked it and I don’t find it in my 2021 version. Is this a new addition in 2022 version?
Thanks for the migration guide. If in case I upgrade, the migration guide will surely help me.