I am having some issues gettig the desired output from the below loops. My desired output is an array that looks like the following.
Array
(
[0] => Array
(
[0] => 10013
[1] => 8
[2] => 2
[3] => 6
[4] => Array
(
[0] => Array
(
[0] => Jerk Chicken
[1] => Drink
[2] => 8
[3] => 2
[4] => 6
)
)
)
[1] => Array
(
[0] => 10107
[1] => 28
[2] => 28
[3] => 0
[4] => Array
(
[0] => Array
(
[0] => Konig Pilsener
[1] => Tobacco
[2] => 3.5
[3] => 3.5
[4] => 0
)
)
)
[2] => Array
(
[0] => 10259
[1] => 18
[2] => 18
[3] => 0
[4] => Array
(
[0] => Array
(
[0] => Trailer Grog
[1] => Tobacco
[2] => 7
[3] => 7
[4] => 0
)
)
)
[3] => Array
(
[0] => 10375
[1] => 8
[2] => 2
[3] => 6
[4] => Array
(
[0] => Array
(
[0] => Steak Sandwhich
[1] => Drink
[2] => 8
[3] => 2
[4] => 6
)
)
)
)
The only problem is it should be showing me more values not those above that I am getting.
I should see this: http://awesomescreenshot.com/0321af5cc4
Thanks for any help. I assure you I have tried so many variations of below and yet to no avail.
// all passing through correctly
global $actual;
global $potentialarray;
global $compsarray;
global $CheckName;
}
unset($temparray);
unset($temparray2);
$i=0;
foreach ($CheckName as $value) {
$v=0;
$query8 = "SELECT * FROM Comps_Item_Name WHERE DOB="."'". $from_date."'"." AND CheckID=" . $value ." ORDER BY CheckID AND ITMNAME";
$result8 = mysql_query($query8) or die(mysql_error());
//$var= mysql_num_rows($result8);
$row1[] = mysql_fetch_array($result8,MYSQL_ASSOC);
//print_r($row1);
//echo'<br>';
foreach ($row1 as $itemvalue){
//Item Name
$itemname = $itemvalue['ITMNAME'];
$catname = $itemvalue['CatName'];
$saleprice = $itemvalue['SalePrice'];
$discount1 = $itemvalue['Discount'];
//Actual retail value of check
$actual1= $itemvalue['SalePrice'] - $itemvalue['Discount'];
$temparray[$i][$v] = array($itemname, $catname, $saleprice, $discount1, $actual1);
$v++;
}
echo '<pre>';
print_r($temparray[$i]);
echo '</pre>';
$temparray2[$i] = array($CheckName[$i], $potentialarray[$i], $compsarray[$i], $actual[$i], $temparray[$i]);
$i++;
unset($row1);
}
// $DesiredOutput = array($CheckName, $potential[$i], $comps[$i], $actual[$i], array($itemname[$i][$v], $catnam[$i][$v], $saleprice[$i][$v], $discount1[$i][$v], $actual1[$i][$v]));
unset($itemname);
unset($catname);
unset($saleprice);
unset($discount1);
unset($actual1);
echo '<pre>';
print_r($temparray2);
echo '</pre>';
Any thoughts?? Cheers.