In the following code from UPDATE_ACTION,       the department associations should
be cleared by the DELETE FROM department_item where Item = n query. However,
in my application, once an item updated, the entry is duplicated in the
department. I checked the department_item table and only one entry is being
deleted. If there is only one entry, another is added.
This is bizarre! I printed the query string and it is correct, if I enter it
in a mysql client all the entries for that item ARE deleted, but the problem
still occurs when I run the application.
I am using mysql 3.22.32 and 3.23.32 on two different machines and I still
get the error.

/*
        ** Clear old department associations.
        */
        if ($continueScript)
        {
                $Query = "DELETE FROM department_item where Item=" . intval($item);
                print ($Query . " <BR>");
                if(!mysql_query($Query, $DatabaseLink))
                {
                        $ActionResults[] = mysql_errno() . ": " . mysql_error() .
                                "   Query was: $repeatQuery";
                        $continueScript = FALSE;
                }
        }

        /*
        ** Associate with departments.
        */
        if ($continueScript)
        {
                for($index = 0; $index < count($inputDepartment); $index++)
                {
                        $Query = "INSERT INTO department_item VALUES (";
                        $Query .= intval($inputDepartment[$index]) . ", ";
                        $Query .= intval($item);
                        $Query .= ")";


                        if(!mysql_query($Query, $DatabaseLink))
                        {
                                $ActionResults[] = mysql_errno() . ": " . 
mysql_error() .
                                        "   Query was: $repeatQuery";
                                $continueScript = FALSE;
                        }

                                        }
        }







Chris Mason
Box 340, The Valley, Anguilla, British West Indies
Tel: 264 497 5670 Fax: 264 497 8463
USA Fax (561) 382-7771
Take a virtual tour of the island
http://net.ai/ The Anguilla Guide
Find out more about NetConcepts
www.netconcepts.ai
Talk to me in real time with Instant Messenger: [EMAIL PROTECTED]
Signature
F331 8AD1 36FB B3B0 DF9F  D95B 8024 D1EA 7450 D50C




------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Site:            http://www.working-dogs.com/freetrade/
Problems?:       [EMAIL PROTECTED]

Reply via email to