troubleshooting Question

MySQL Temp Table

Avatar of rcowen00
rcowen00Flag for United States of America asked on
MySQL ServerPHP
4 Comments1 Solution492 ViewsLast Modified:
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)

<?php
error_reporting(E_ALL);

        $userIDKey=$userListRow['id'];
        include 'include/userConnect.php';

        $beginDate=mysql_real_escape_string($_POST['begin']);
        $endDate=mysql_real_escape_string($_POST['end']);
        $auditTypeKey=mysql_real_escape_string($_POST['type']);
        $branchKey=mysql_real_escape_string($_POST['branch']);

            $d = "DROP Table if exists auditMgmt";
             mysql_query($d) or die(mysql_error());
            $c = "CREATE TABLE auditMgmt SELECT loan.loanKey,
                loan.loanNumber,
                borrower.lastName,
                borrower.firstName,
                audit.auditID,
                loan.branchKey,
                audit.trackingDate
                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());
                                             ?>
ASKER CERTIFIED SOLUTION
Beverley Portlock

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros