Format Display problems
$ress = array ( 0 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4409', 'lotno' => '4409', 2 => 300, 'part_count' => 300, ), 1 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4410', 'lotno' => '4410', 2 => 141, 'part_count' => 75, ), )foreach($ress as $source){if($source['part_count'] != 0){$lotno_count = $source['lotno'].' * '.$source['part_count'];echo $lotno_count.'
';}}
Mainly added
The last line contains spaces. You can remove spaces in the last line. Thank you!
Reply to discussion (solution)
$ress = array ( 0 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4409', 'lotno' => '4409', 2 => 300, 'part_count' => 300, ), 1 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4410', 'lotno' => '4410', 2 => 141, 'part_count' => 75, ), ); foreach($ress as $source) { if($source['part_count'] != 0) { $lotno_count[] = $source['lotno'].' * '.$source['part_count']; }}echo join('
', $lotno_count);
4409*300
4410*75
$ress = array ( 0 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4409', 'lotno' => '4409', 2 => 300, 'part_count' => 300, ), 1 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4410', 'lotno' => '4410', 2 => 141, 'part_count' => 75, ), ); foreach($ress as $source) { if($source['part_count'] != 0) { $lotno_count[] = $source['lotno'].' * '.$source['part_count']; }}echo join('
', $lotno_count);
4409*300
4410*75
What if this happens?
Foreach ($ ress as $ source)
{
If ($ source ['cust _ no'] = '237033aw0a ')
{
If ($ source ['part _ count']! = 0)
{
$ Lotno_count [] = $ source ['lotno']. '*'. $ source ['part _ count'];
}
}
}
What is the difference?
You only need to output the final output
No need to cache the last one.