firekiller15
asked on
Why output array is not in correct order
PHP
i have this code in code snippet
my output code $data1 = "{$datas} | {$datas1}";
print_r( $data1);
in my output get amount i suppose to get 6 item display on the screen.
dont know why i only get one item display on the screen
the item here i refered is the ouput select data that i call by the condition of 1234,6545,5468,9856,"no stock",4561,5466
why only one item return to my screen?
function GetAmount()
{
$ItemID = array(1234,6545,5468,9856, "no stock",4561,5466);
$arrayElement[3] = "no stock";
$supermarketID = 21;
$i = 0;
$j = 0;
for ($j = 0; $j < sizeof($ItemID); $j++)
{
if (($ItemID[$j] != $arrayElement[3])
{
$query = "SELECT getitem_std_amount( \"$supermarketID\", \"ItemID[$j]\") AS AMOUNT";
$result = mysql_query($query);
if(!$result) die("Query didn't work. " . mysql_error());
while($row = mysql_fetch_array($result) )
{
$this->GetAmountReturn[$i+ +] .= '"'.$row['AMOUNT'].'"';
$i++;
}
}
else
{
$this->GetAmountReturn[$i+ +] .= "\"no stock\" |";
$i++;
}
}
function joinSUPERMARKETNAMEnAMOUNT ()
{
//SUPERMARKETNAME select value is from another function
foreach(($this->GetSuperma rketReturn _value as $datas)
{
foreach($this->GetAmountRe turn as $datas1)
{
$data1 = "{$datas} | {$datas1} ";
print_r( $data1);
}
}
}
i have this code in code snippet
my output code $data1 = "{$datas} | {$datas1}";
print_r( $data1);
in my output get amount i suppose to get 6 item display on the screen.
dont know why i only get one item display on the screen
the item here i refered is the ouput select data that i call by the condition of 1234,6545,5468,9856,"no stock",4561,5466
why only one item return to my screen?
function GetAmount()
{
$ItemID = array(1234,6545,5468,9856,
$arrayElement[3] = "no stock";
$supermarketID = 21;
$i = 0;
$j = 0;
for ($j = 0; $j < sizeof($ItemID); $j++)
{
if (($ItemID[$j] != $arrayElement[3])
{
$query = "SELECT getitem_std_amount( \"$supermarketID\", \"ItemID[$j]\") AS AMOUNT";
$result = mysql_query($query);
if(!$result) die("Query didn't work. " . mysql_error());
while($row = mysql_fetch_array($result)
{
$this->GetAmountReturn[$i+
$i++;
}
}
else
{
$this->GetAmountReturn[$i+
$i++;
}
}
function joinSUPERMARKETNAMEnAMOUNT
{
//SUPERMARKETNAME select value is from another function
foreach(($this->GetSuperma
{
foreach($this->GetAmountRe
{
$data1 = "{$datas} | {$datas1} ";
print_r( $data1);
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.