thanks for the reply
//in initiate
$this->shop = new shop();
//then I am looping through my getDrill3();
foreach($this->shop->getDrill3($subCat3) as $e=>$f){
//echo out data
}
//here is my shop class
class shop extends model{
//-----------------------------
//method to get drill3 content
//-----------------------------
public function getDrill3($d2id){
$this->d2id = $d2id;
$sql = "SELECT * FROM abc.drill3
WHERE D3D2A = '".db2_escape_string($this->d2id)."'
OR D3D2B = '".db2_escape_string($this->d2id)."'
OR D3D2C = '".db2_escape_string($this->d2id)."'";
$this->db->query($sql,'');
while($this->db->multiRows()){
//check count on drills
$this->tc = $this->checkDeadDrill($this->db->rec['D3ID']);
$this->drill3[$this->c]['id'] = rtrim($this->db->rec['D3ID']);
$this->drill3[$this->c]['desc'] = rtrim($this->db->rec['D3DESC']);
$this->drill3[$this->c]['cnt'] = $this->tc;
$this->c++;
}
return $this->drill3;
//end method getDrill2();
}
//-----------------------------
//method to check for "dead" drills
//-----------------------------
public function checkDeadDrill($id){
$this->checkD3 = $id;
//set our current date to weed out DISC items
$this->currDate = date('Ymd');
$sql2 = "SELECT * FROM abc.drill4
JOIN abc.itemmast on IITEM = D4ITEM AND ICO = 1
WHERE (IDDATE > ".$this->currDate." OR IDDATE = 0)
AND (
D4D3A = '".db2_escape_string($this->checkD3)."'
OR D4D3B = '".db2_escape_string($this->checkD3)."'
OR D4D3C = '".db2_escape_string($this->checkD3)."')";
$this->db->query($sql2,'');
while($this->db->multiRows()){
$this->checkDead[]['item'] = trim($this->db->rec['D4ITEM']);
}
return count($this->checkDead);
//end method checkDeadDrill();
}
}
if i remove the checkDeadDrill call inside the getDrill3 and call it via the foreach() loop it gets the correct return value on the 1st iteration but then it keeps adding up.
for example:
//then I am looping through my getDrill3();
foreach($this->shop->getDrill3($subCat3) as $e=>$f){
$check = $this->shop->checkDeadDrill($f['id']);
echo $check.'<br/>'; //
//echo out data
}
the first return is the correct amount which is 9. Then from there it just keeps adding up that 9.
9
18
27
36
etc...
instead of return the correct value for each id I pass the method. Again, if I call the checkDeadDrill inside of getDrill3 my foreach loop doesn't return any data.
If I test:
echo $this->shop->checkDeadDrill('49'); // or any id it returns successfully.
Is it possible it has something to do w/ my DB class?