Stumped: MySQL corruption? DB Insert failing. PHP Code referencing a column in different table, but running correct code?

I have a function that updates two tables.  In my code I pass an ID field to be updated.  The ID comes from a javascript function/application.

I have made no changes to my code and at one time a couple of weeks ago, the code was working perfectly.

The error below is referencing 'delivery_detail.poID'.  The javascript does not reference delivery_detail, the PHP does not reference delivery_detail

I am using CodeIgniter MVC framework for my PHP.


The error is (from firebug):
Error Number: 1054
Unknown column ‘delivery_detail.poID’ in ‘where clause’
UPDATE `status_order` SET `status` = ‘Stock’, `stockDate` = 1272214095 WHERE `poID` = ‘52988’  </div>

//Controller
function convertToStock ($poID=null) {
        $poID=$this->input->post('poID');
        
        if ($poID) {
        $data=$this->inTransit_model->convertStock($poID);
        $this->_printSuccessTrue($data);
        } else {
            $this->_printSuccessFalse();
        }
        
    }
............
//Model
function convertStock($poID) {
        $this->load->helper('date');
        $orderArray = Array (
            'status' => 'Stock'
            ,'stockDate' =>now()
        );
        $this->db->where('poID', $poID);
        $this->db->set($orderArray);
        $this->db->update('status_order');
        
        $tallyArray = Array (
            'tallyStatus' => 'Stock'
            ,'stockDate' =>Now()
        );
        
        $this->db->where('poID', $poID);
        $this->db->set($tallyArray);
        $this->db->update('status_tally');
        
        return true;
        
    }

Open in new window

TumacLumberAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Muhammad KhanManager, ITCommented:
strange... although i too have no idea why this is happening.. but just a wild guess
status_order has any foreign key relationship with delivery_detail table?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TumacLumberAuthor Commented:
Aha..... no Foreign Key but I forgot it has a trigger.....The trigger is making the faulty reference.  That is the problem with not touching a piece of code for a few weeks....

Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.