matthewbonline — 2011-09-16T05:30:07-04:00 — #1
If I add to a database MySQL Table on line 20 of the code in the page, then I extract from THE SAME MYSQL table on line 40 (of the same page) will this work?
starlion — 2011-09-16T08:14:36-04:00 — #2
As long as you execute the query on line 20, then Yes, that record will exist when you query the table on line 40. the database connection is a fluid connection, not a snapshot.
matthewbonline — 2011-09-16T10:24:34-04:00 — #3
cool - I just wondered whether it might be too quick to expect the data to be available?
I thought it would take 0.3 seconds to add to database and 0.2 seconds to load/view the page. This would mean the data is not in the table!
This is for my basket system. There will be about 10-15 fields added to the database. Should they be in the database quick enough to be used in the same page?! Is there a limit?
starlion — 2011-09-16T10:38:23-04:00 — #4
queries are not asynchronous - PHP will wait for the database server to reply before it continues processing, and the server will only send a reply once it's done doing whatever the query was.