We help IT Professionals succeed at work.
Get Started

MySQL Temp Table

rcowen00 asked
Last Modified: 2012-05-02
Hi Experts,

The following code works but is incorrect because multiple users will over write each other.  I have been playing with moving it to a Temp table but that isn't working because the temp table is gone when I move to a new page.  The process I am trying to do is as follows, how should I be doing this? Session variables?  query string? temp table? Other?  I know what I am doing is wrong.  Thanks!

The user selects a group of loans by date/audit type.
A list of the selected loans are listed with a href link that open the profile screen
At the top of the page there is a button to go to the next or previous loan in the subset (that is why I have the table in the first place to store the subset)


        include 'include/userConnect.php';


            $d = "DROP Table if exists auditMgmt";
             mysql_query($d) or die(mysql_error());
            $c = "CREATE TABLE auditMgmt SELECT loan.loanKey,
                FROM loan
                JOIN audit USING (loanKey)
                LEFT JOIN borrower USING (loanKey)
                WHERE loan.branchKey='$branchKey'
                AND audit.activeStatus='1'
                AND auditTypeKey='$auditTypeKey'
                AND borrower.type='1'
                AND borrower.active='1'
                AND trackingDate BETWEEN '$beginDate' AND '$endDate'
                ORDER BY audit.auditID";
            mysql_query($c) or die(mysql_error());

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE