select and insert on one page

admin

Administrator
Staff member
Hi all,
I'm a PHP newbie but coming up to speed quickly. After only five days, I've converted over an ASP site and am 3/4 through an ASP/MSSQL application. I'm using PHP with MySQL and so far, really dig both. And my app is pulling data a lot quicker!

Okay, so I have one update page where I have to retrieve records and get an ID from the last record. I take that ID, add one and then proceed to build an insert statement using that variable plus a whole bunch of others. The insert then runs, at which point I redirect to another page.

Now, I've tried this a bunch of different ways but in all cases, the first query works, but the insert doesn't. If I run the insert on a separate page by itself, it works. What is the proper way to do both on the same page? Can I use the existing variables for the db conn used on the first query, on the second one as well? Or should I open a new connection?

Thanks for any help,
Steve
 
Back
Top