Jump to content


This topic is now archived and is closed to further replies.


group same package with different expire day

Recommended Posts

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;
$res .= $s . ', ';
if ($n != 0)
if ($i++ % $n == 0) $res .= '<br />';
return $res;

The result data for $result3 is as below : -
package serialNo expireday
pr_unlimited 1000 1
pr_unlimited 1001 1
pr_unlimited 1010 7
pr_unlimited 1011 7
pr_Oneday 1020 1
pr_Oneday 1021 1

How to group the package as below : -
package expireday serialNo
pr_unlimited 1 1000,1001
pr_unlimited 7 1010,1011
pr_Oneday 1 1020,1021

Please advise. Thanks.

Share this post

Link to post
Share on other sites
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

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.