Insert then select ??

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Deddog
Forum Commoner
Posts: 55
Joined: Thu Sep 26, 2002 6:05 am
Location: Brighton

Insert then select ??

Post 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.
cctrax
Forum Commoner
Posts: 36
Joined: Thu Jul 11, 2002 9:05 pm
Location: United States
Contact:

Post by cctrax »

We really can't tell. If I were you, I would just post the code...
marcelognunez
Forum Newbie
Posts: 1
Joined: Tue Apr 15, 2003 4:18 pm

Post by marcelognunez »

what database are you using MySQL, PostgresSQL or Other?
problem maybe can be the web cache in the explorer, do you test?
User avatar
AlphaWolf
Forum Newbie
Posts: 12
Joined: Sun Mar 23, 2003 8:49 pm

Post 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
Post Reply