klpang Posted June 17, 2006 Share Posted June 17, 2006 i have developed a program to group package, serial no. and expire day of package. but i face one issue, during group by same package name but the expire day is different. the program will group it as a same package without differentiate the expire day. below is the my coding that group different package with different expire day.$result3 = mysql_query("SELECT package, serialNo, expireDay FROM orderdetail WHERE resellerID = '$resellerID' AND orderNo='$orderNo' order by package, serialNo");$data = array();while (list($p, $s, $e) = mysql_fetch_row($result3)){ echo $data[$p][] = $s;}foreach($data as $pkg => $s_array) { $num = count($s_array); $serial= listSerNums($s_array,0); $resultvalue = mysql_query("select package, valuedesc, pricePerUnit from batch a, prepaidcard b where a.batchNo = b.batchNo and b.serialNo in ($serial)") or die(mysql_error()); $rowvalue = mysql_fetch_array($resultvalue);}function listSerNums($sers, $n) { $i = 1; $j = 1; $x = count($sers); foreach ($sers as $s) { if ($j++ == $x) { $res .= $s; } else { $res .= $s . ', '; } if ($n != 0) { if ($i++ % $n == 0) $res .= '<br />'; } } return $res;}The result data for $result3 is as below : -package serialNo expiredaypr_unlimited 1000 1pr_unlimited 1001 1pr_unlimited 1010 7pr_unlimited 1011 7pr_Oneday 1020 1pr_Oneday 1021 1How to group the package as below : -package expireday serialNopr_unlimited 1 1000,1001pr_unlimited 7 1010,1011pr_Oneday 1 1020,1021Please advise. Thanks. Link to comment https://forums.phpfreaks.com/topic/12228-group-same-package-with-different-expire-day/ Share on other sites More sharing options...
redarrow Posted June 17, 2006 Share Posted June 17, 2006 i thort i have my say that i got meny friends in php that expire there programs via a session.if that helps.only an idear Link to comment https://forums.phpfreaks.com/topic/12228-group-same-package-with-different-expire-day/#findComment-46616 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.