Posted by admin | Posted in PHP | Posted on 29-10-2009
0
Mr.T 先生買了5個胡椒餅
1個是35元,3個是100元
請問5個是多少錢!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| <?
$price = 35;
$count = 5;
$a = $count % 3; //得到2
$b = $count / 3; //1.6
$c = intval($b) * 100; 去小數 X 100元
$order = $a * $price;
echo $sum = $c + $order;
?> |
我看了客戶之前的購物車… 他只有二種商品可以選 1個是 35元 3個是100元
按下去後到結帳,我輸入3個 金額是 105元…
Posted by admin | Posted in PHP | Posted on 29-10-2009
0
8M 的迷失….
下午程式寫好後…測驗Download 程式
發現Download 下來開一半會錯誤
改了很多東西…最後上網查才看到Key Message…
就是php.ini 設定8M的問題
ini_set(’memory_limit’, ‘50M’);
原來我Download 的大小超過8M
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| if(!eregi("usi", $_POST['c_email'])) { } else {
//Add User Log
$c_date = date("Y-m-d H:i:s");
$c_ip = $_SERVER["REMOTE_ADDR"];
$c_file = $row_rs_company['c_file'];
$addsql = "INSERT INTO tb_duser (c_sn,c_email,c_file,c_ip,c_date) VALUES ($_POST[c_sn],'$_POST[c_email]','$c_file','$c_ip','$c_date')";
$rs_save = mysql_query($addsql, $company) or die(mysql_error());
// Download Hit
$count = $_POST['c_sn'];
$query_rs_count = "UPDATE tb_company SET c_count = c_count + 1 WHERE c_sn = $count";
$rs_count = mysql_query($query_rs_count, $company) or die(mysql_error());
//Download company
if ($totalRows_rs_company > 0) {
$dl_file = $row_rs_company['c_file'];
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-Type: application/octet-stream");
$header="Content-Disposition: attachment; filename=".$dl_file.";";
header($header);
@readfile("ppt/".$dl_file);
}
} // c_email |