Page 1 of 1

Insert then select ??

Posted: Mon Apr 14, 2003 10:18 am
by Deddog
Ok here’s the scenario

I input a load of data into a table. Directly under the “Insert sql” I run a select statement based on finding the data I have just inserted. It always comes up blank. If I go back in to the page and search again then the data appears.

I have taken to closing mysql connections after the insert in the hope that a new connection will in effect refresh the database and display the new data – didn’t work.

With out posting a shed load of code here, is there anything in the protocol / logic that I’m missing?

Cheers,

Lee.

Posted: Tue Apr 15, 2003 1:20 pm
by cctrax
We really can't tell. If I were you, I would just post the code...

Posted: Tue Apr 15, 2003 4:18 pm
by marcelognunez
what database are you using MySQL, PostgresSQL or Other?
problem maybe can be the web cache in the explorer, do you test?

Posted: Fri Apr 18, 2003 2:44 pm
by AlphaWolf
I have always found it easier to simply break up your tasks in 2 files.

Page 1: Get your data from some previous page, in this page, insert your data.

Page 2: Display your data from page 1.

You could also use a redirect in Page 1 after the inserting of the data is done, so the user technically wouldn't even see page 1, but it would perform the task you needed to do.

Just my .02