Kourosh
Kourosh

Reputation: 618

How to know if the insert function to mysql is done successfully?

Inside my php I have a function which creates a connection to my db, insert info and closes the connection. I want to use the same function to write into another db as well. But before I attempt to make connection the other db I need to know that the first query is executed successfully. Is there a way to make the php wait until the insert function is done? like a while loop or something?

Upvotes: 1

Views: 522

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798526

Unless you use INSERT DELAYED the insert is synchronous. Test the return value in order to see if the insert succeeded.

Upvotes: 2

Related Questions