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?
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.
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?
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.