 |
ผู้รู้ช่วยอธิบายcode ที่ละบรรทัดให้หน่อยนะคับ ขอร้องเถอะช่วยที |
|
 |
|
|
 |
 |
|
<?php
if($promo=="true"){
$sql="delete from promotion where promotion_status='0'";
mysql_db_query($dbName,$sql);
}
$sql1="select * from `saledata` where saledata_status='1' ";
$result1=mysql_db_query($dbName,$sql1);
if (!$result1)
{ die('invalid result1 order query' . mysql_error());}
$row1=mysql_num_rows($result1);
echo "<h3>ใบสั่งซื้อมีทั้งหมด --> $row1 ใบสั่งซื้อ</h3><br>";
$count=0;
while ($rs = mysql_fetch_array($result1))
{
$order_id=$rs['saledata_orderid'];
$orderitem_id=$rs['saledata_products'];
$count++;
$x=explode(',',$rs['saledata_products']);
//echo "ใบสั่งซื้อที่ ($count) $order_id <br> $orderitem_id ".sizeof($x)."<br>";
/*echo sizeof($x);*/
for($i=0;$i<sizeof($x)-2;$i++){
for($j=$i+1;$j<=sizeof($x)-2;$j++){
$sql="select * from `saledata` where saledata_products like '%$x[$i]%' ";
$result=mysql_db_query($dbName,$sql);
if (!$result)
{ die('invalid result order query' . mysql_error());}
$row=mysql_num_rows($result);
$sql2="select * from `saledata` where saledata_products like '%$x[$i]%' and saledata_products like '%$x[$j]%' ";
$result2=mysql_db_query($dbName,$sql2);
if (!$result2)
{ die('invalid result2 order query' . mysql_error());}
$row2=mysql_num_rows($result2);
$SUPPORT=number_format($row/$row1*100,2);
$CONFIDENT=number_format($row2/$row*100,2);
if ($SUPPORT>=$_POST[SUPPORT_INPUT] && $CONFIDENT>=$_POST[CONFIDENT_INPUT] )
{
//echo $x[$i].'-'.$x[$j]."<br><font color='blue'>[SUP : $SUPPORT ] [CON : $CONFIDENT ]</font><br>";
if($promo=="true"){
$ac=$x[$i].'-'.$x[$j];
$sql="insert into promotion values('','$ac','$SUPPORT_INPUT-$CONFIDENT_INPUT','$SUPPORT','$CONFIDENT','','','','','0')";
$result=mysql_db_query($dbName,$sql);
}
}
}
}
//echo '<br>--------------------------------------------------------<br>';
}
?>
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2009-05-12 11:08:07 |
By :
pentagon |
View :
1059 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คิดจะช่วยตัวเองก่อนรึยังครับเนี่ย 
|
 |
 |
 |
 |
Date :
2009-05-12 12:41:16 |
By :
rasabut |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
http://www.php.net/manual/en/langref.php แนะนำให้ไปดู ref ที่เว็บเจ้าของเค้าเลยถ้าไมูู่้รู้คำสั่งไหน เรียนรู้แระเข้าใจด้วยตัวเอง
จะทำให้เราเก่งได้ไวกว่านะ ดีกว่าให้คนอื่นเขียนให้
|
 |
 |
 |
 |
Date :
2009-05-12 12:45:15 |
By :
melodyApinan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เล่นงี้เหนือยเลย
|
 |
 |
 |
 |
Date :
2009-05-12 12:57:28 |
By :
suneogaz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อธิบายได้คับ แต่คิดตัง 
|
 |
 |
 |
 |
Date :
2009-05-12 15:37:04 |
By :
pjgunner |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|