jlhamma
03-10-2010, 10:14 PM
I'm pulling data from a query into an array for one use. But I need to put the 2nd field into another array for a different use. Using a print function just to see results. Results look like this:
Array ( [tID] => 61 [0] => J20 ) Array ( [tID] => 62 [0] => J21 ) Array ( [tID] => 63 [0] => J22 )
I need the last elements (J20, J21, J22). How do I return just those to use later?
$id_data is what I'm looking at.
if (!empty($query_prod)) {
$i=0;
$n=0;
while($row = mysql_fetch_array($query_prod)) {
$xls_data[$i] = $row;
$id_data[$n] = $xls_data[$i];
$id_data[$n] = array_slice($id_data[$n], 1, 2);
$i++; $n++; }
for($i = 0; $i < sizeof($xls_data);$i++) {
$i = printTableRow4($xls_data[$i],$i); }
for($n = 0; $n < sizeof($id_data);$n++) {
print_r($id_data[$n]); }
Array ( [tID] => 61 [0] => J20 ) Array ( [tID] => 62 [0] => J21 ) Array ( [tID] => 63 [0] => J22 )
I need the last elements (J20, J21, J22). How do I return just those to use later?
$id_data is what I'm looking at.
if (!empty($query_prod)) {
$i=0;
$n=0;
while($row = mysql_fetch_array($query_prod)) {
$xls_data[$i] = $row;
$id_data[$n] = $xls_data[$i];
$id_data[$n] = array_slice($id_data[$n], 1, 2);
$i++; $n++; }
for($i = 0; $i < sizeof($xls_data);$i++) {
$i = printTableRow4($xls_data[$i],$i); }
for($n = 0; $n < sizeof($id_data);$n++) {
print_r($id_data[$n]); }