[eluser]rvent[/eluser]
Is this legal..?
Code:
$this->db->select('PartNumberID, PartNumber');
$this->db->from('smt_dev.PartNumber');
$this->db->where('PartNumber', $partn);
$que = $this->db->get();
foreach ($que->result() as $par_id)
{
$parid = $par_id->PartNumberID;
$this->db->select('PartLocationID, PartLocation');
$this->db->from('smt_dev.PartLocation');
$this->db->where('PartLocation', $ploc);
$pl = $this->db->get();
foreach ($pl->result() as $loc_id)
{
$locid = $loc_id->PartLocationID;
$this->db->select('PartPriorityID, PartPriority');
$this->db->from('smt_dev.PartPriority');
$this->db->where('PartPriority', $pprio);
$priori = $this->db->get();
foreach ($priori->result() as $pri_id)
{
$prid = $pri_id->PartPriorityID;
$this->db->select('PartStateID, PartState');
$this->db->from('smt_dev.PartState');
$this->db->where('PartState', $psta);
$ps = $this->db->get();
foreach ($ps->result() as $psta_id)
{
$pstaid = $psta_id->PartStateID;
$this->db->select('PartStatusID, PartStatus');
$this->db->from('smt_dev.PartStatus');
$this->db->where('PartStatus', $pstatus);
$psu = $this->db->get();
foreach ($psu->result() as $pstatu_id)
{
$pstatuid = $pstatu_id->PartStatusID;
$this->db->set('WOrder', $worko);
$this->db->set('WODateIn', $datein);
$this->db->set('WODateOut', $dateout);
$this->db->set('WOCreatedAt', $createdat);
$this->db->set('WOUpdatedAt', $updatedat);
$this->db->set('WOCompletedAt', $updatedat);
$this->db->set('WOPartQuantity', $quantity);
$this->db->set('WOrderID', NULL);
$this->db->set('PartNumberID', $parid);
$this->db->set('PartLocationID', $locid);
$this->db->set('PartPriorityID', $prid);
$this->db->set('PartStateID', $pstaid);
$this->db->set('PartStatusID', $pstatuid);
$this->db->set('MessageID', NULL);
$this->db->insert('WorkOrder');
}
}
}
}
}