Hi!
I have several 1 dimensional arrays..The key is the $part_id..
$part_id $supplier $name $code $poqty $soqty
To print the contents I use :
foreach ($part_id as $a) { echo "<tr><td>$supplier[$a]</td>"; echo "<td>$name[$a]</td>"; echo "<td>$code[$a]</td></tr>"; echo "<td>$poqty[$a]</td></tr>"; echo "<td>$soqty[$a]</td></tr>"; }
Array contents came from several Postgresql query's..
I have no problem with the query..My problem is with the sorting of the arrays..
I need to sort the arrays in the following sequence : $supplier, $name, $code
You might ask why I did not sort from my query..Answer is it is impossible to order them because
the values of the array came from 3 tables..
Order by using the query is simply not possible..
I tried sorting them this way :
//order asort($code); foreach($code as $a => $v) { $apart_id[$a]=$part_id[$a]; } asort($name); foreach($name as $a => $v) { $bpart_id[$a]=$apart_id[$a]; } asort($supp); foreach($supp as $a => $v) { $cpart_id[$a]=$bpart_id[$a]; } // display foreach ($cpart_id as $a) { echo "<tr><td>$supplier[$a]</td>"; echo "<td>$name[$a]</td>"; echo "<td>$code[$a]</td></tr>"; echo "<td>$poqty[$a]</td></tr>"; echo "<td>$soqty[$a]</td></tr>"; }
Here's a sample output after the order/sort..
------------------------------------------------------------------------- Supplier | Part Code | Part Name | PO Qty |SO Qty | correct order ----------+---------------------+---------------------+--------+--------+ FTSL 1 | 954334-02310730 | Ceramic Condenser | 0 |7890 | 2nd FTSL 1 | 9445R0-05200730 | Ceramic Condenser | 0 |10800 | 1st FTSL 2 | 324941-06100900 | Chemical Condenser | 100 |3300 | 4th FTSL 2 | 324941-06200900 | Chemical Condenser | 0 |4700 | 5th FTSL 2 | 324941-0570A900 | Ceramic Condenser | 300 |500 | 3rd MIC | 981028-03570730 | Connector | 3000 |3000 | 8th MIC | 811600-41650730 | IC | 2000 |654 | 11th MIC | 811600-41050730 | IC | 19000 |18162 | 10th MIC | 811600-31700740 | IC | 2500 |546 | 9th MIC | 954105-03050730 | Ceramic Condenser | 12000 |11166 | 7th MIC | 934100-03650730 | Capacitor | 2000 |546 | 6th
It's supposed to be like this :
------------------------------------------------------------------------- Supplier | Part Code | Part Name | PO Qty |SO Qty | correct order ----------+---------------------+---------------------+--------+--------+ FTSL 1 | 9445R0-05200730 | Ceramic Condenser | 0 |10800 | 1st FTSL 1 | 954334-02310730 | Ceramic Condenser | 0 |7890 | 2nd FTSL 2 | 324941-0570A900 | Ceramic Condenser | 300 |500 | 3rd FTSL 2 | 324941-06100900 | Chemical Condenser | 100 |3300 | 4th FTSL 2 | 324941-06200900 | Chemical Condenser | 0 |4700 | 5th MIC | 934100-03650730 | Capacitor | 2000 |546 | 6th MIC | 954105-03050730 | Ceramic Condenser | 12000 |11166 | 7th MIC | 981028-03570730 | Connector | 3000 |3000 | 8th MIC | 811600-31700740 | IC | 2500 |546 | 9th MIC | 811600-41050730 | IC | 19000 |18162 | 10th MIC | 811600-41650730 | IC | 2000 |654 | 11th
Help..This really gives me a headache!!!
Note: Please use Courier Regular Font..
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php