Jump to content


Photo

group same package with different expire day


  • Please log in to reply
1 reply to this topic

#1 klpang

klpang
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 17 June 2006 - 10:19 AM

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 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.


#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 17 June 2006 - 10:41 AM

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


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users