PHP 板


LINE

看板 PHP  RSS
<?php require_once('Connections/db_conn.php'); ?> <?php mysql_query("SET NAMES UTF8"); ini_set('default_charset','utf-8'); if (!isset($_SESSION)) { session_start(); } if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "delform")) { $updateSQL = sprintf("UPDATE shop_car SET goods_price=%s, ord_num=%s, ord_sum=%s WHERE temp_no=%s", GetSQLValueString($_POST['goods_price'], "int"), GetSQLValueString($_POST['ord_num'], "int"), GetSQLValueString($_POST['goods_price'], "int")*GetSQLValueString($_POST['ord_num'], "int"), GetSQLValueString($_POST['temp_no'], "int")); mysql_select_db($database_db_conn, $db_conn); $Result1 = mysql_query($updateSQL, $db_conn) or die(mysql_error()); $updateGoTo = "shop_car.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } if ((isset($_GET['temp_no'])) && ($_GET['temp_no'] != "") && (isset($_GET['del']))) { $deleteSQL = sprintf("DELETE FROM shop_car WHERE temp_no=%s", GetSQLValueString($_GET['temp_no'], "int")); mysql_select_db($database_db_conn, $db_conn); $Result1 = mysql_query($deleteSQL, $db_conn) or die(mysql_error()); $deleteGoTo = "shop_car.php"; if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $deleteGoTo)); } mysql_select_db($database_db_conn, $db_conn); $query_showitemRec = "SELECT * FROM shop_item"; $showitemRec = mysql_query($query_showitemRec, $db_conn) or die(mysql_error()); $row_showitemRec = mysql_fetch_assoc($showitemRec); $totalRows_showitemRec = mysql_num_rows($showitemRec); $colname_carRec = "-1"; if (isset($_SESSION['tempord_id'])) { $colname_carRec = $_SESSION['tempord_id']; } mysql_select_db($database_db_conn, $db_conn); $query_carRec = sprintf("SELECT * FROM shop_car WHERE ord_id = %s ORDER BY temp_no DESC", GetSQLValueString($colname_carRec, "text")); $carRec = mysql_query($query_carRec, $db_conn) or die(mysql_error()); $row_carRec = mysql_fetch_assoc($carRec); $totalRows_carRec = mysql_num_rows($carRec); ?> </table><br /> <table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <tr valign="top"> <td><table width="750" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="170" valign="top"><?php do { ?> <table width="170" border="0" align="center" cellpadding="0" cellspacing="0" id="item"> <tr> <td colspan="2" background="../Chaoyang_Food/images/mod_nw.gif"></td> <td width="5"><img src="../Chaoyang_Food/images/mod_ne.gif" width="5" height="5" /></td> </tr> <tr> <td width="5" background="../Chaoyang_Food/images/mod_left.gif"><img src="../Chaoyang_Food/images/mod_left.gif" width="5" height="5" /></td> <td width="160" bgcolor="#7894AF"><p class="style8 style18"><?php echo $row_showitemRec['item_name']; ?></p></td> <td rowspan="2" background="../Chaoyang_Food/images/mod_right.gif"></td> </tr> <tr> <td background="../Chaoyang_Food/images/mod_left.gif"></td> <td width="160" rowspan="3" bgcolor="#EFEFF8"><table width="100%" border="0" cellpadding="0" cellspacing="0" id="goods"> <?php mysql_select_db($database_db_conn, $db_conn); $query_showgoodsRec = sprintf("SELECT * FROM shop_goods WHERE item_id = %s", GetSQLValueString($row_showitemRec['item_id'], "text")); $showgoodsRec = mysql_query($query_showgoodsRec, $db_conn) or die(mysql_error()); $row_showgoodsRec = mysql_fetch_assoc($showgoodsRec); $totalRows_showgoodsRec = mysql_num_rows($showgoodsRec); if ($totalRows_showgoodsRec > 0) { do {?> <tr> <td width="9%"><img src="../Chaoyang_Food/images/arrows_blue.gif" width="15" height="21" /></td> <td width="91%"><a href="shop_goods.php?goods_id=<?php echo $row_showgoodsRec['goods_id']; ?>"> <?php echo $row_showgoodsRec['goods_name']; ?> </a></td></tr> <?php } while ($row_showgoodsRec = mysql_fetch_assoc($showgoodsRec)); }?> </table></td> </tr> <tr> <td background="../Chaoyang_Food/images/mod_left.gif"></td> <td background="../Chaoyang_Food/images/mod_right.gif"></td> </tr> <tr> <td background="../Chaoyang_Food/images/mod_left.gif"></td> <td background="../Chaoyang_Food/images/mod_right.gif"></td> </tr> <tr> <td colspan="2" background="../Chaoyang_Food/images/mod_sw.gif"></td> <td><img src="../Chaoyang_Food/images/mod_se.gif" width="5" height="5" /></td> </tr> <tr> <td height="10" colspan="3"></td> </tr> </table> <?php } while ($row_showitemRec = mysql_fetch_assoc($showitemRec)); ?></p> </p> </p></p></td> <td width="580" align="right" valign="top"><table width="560" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" background="../Chaoyang_Food/images/mod_nw.gif"></td> <td width="5"><img src="../Chaoyang_Food/images/mod_ne.gif" width="5" height="5" /></td> </tr> <tr> <td width="5" background="../Chaoyang_Food/images/mod_left.gif"><img src="../Chaoyang_Food/images/mod_left.gif" width="5" height="5" /></td> <td width="550" bgcolor="#9DACBF"><p align="left" class="style19"><span class="style22">檢視購物車</span>(如出現商品有重複購買情形,請刪除其中一個,請各位見諒!)</p></td> <td rowspan="2" background="../Chaoyang_Food/images/mod_right.gif"></td> </tr> <tr> <td background="../Chaoyang_Food/images/mod_left.gif"></td> <td width="550" bgcolor="#FFFFFF"><div align="center"> <?php if ($totalRows_carRec > 0) { // Show if recordset not empty ?> <table width="100%" border="0" cellspacing="2" cellpadding="0"> <tr> <td width="38%"><div align="left" class="style21">品名</div></td> <td width="9%"><div align="left" class="style21">數量</div></td> <td width="12%"><div align="left" class="style21">單價</div></td> <td width="16%"><div align="left" class="style21">小計</div></td> <td width="25%"><div align="left"></div></td> </tr> <?php $total=0; do { ?> <tr> <form method="POST" action="<?php echo $editFormAction; ?>" name="delform" id="delform"> <td><div align="left"><strong><?php echo $row_carRec['goods_name']; ?></strong></div></td> <td><div align="left"> <select name="ord_num" id="ord_num"> <option value="5" <?php if (!(strcmp(5, $row_carRec['ord_num']))) {echo "selected=\"selected\"";} ?>>5</option> <option value="10" <?php if (!(strcmp(10, $row_carRec['ord_num']))) {echo "selected=\"selected\"";} ?>>10</option> <option value="15" <?php if (!(strcmp(15, $row_carRec['ord_num']))) {echo "selected=\"selected\"";} ?>>15</option> <option value="20" <?php if (!(strcmp(20, $row_carRec['ord_num']))) {echo "selected=\"selected\"";} ?>>20</option> <option value="25" <?php if (!(strcmp(25, $row_carRec['ord_num']))) {echo "selected=\"selected\"";} ?>>25</option> </select> </div></td> <td><div align="left"><strong>NT$<?php echo $row_carRec['goods_price']; ?></strong></div></td> <td><div align="left"><strong>NT$<?php echo $row_carRec['ord_sum']; ?></strong></div></td> <td><input name="temp_no" type="hidden" id="temp_no" value="<?php echo $row_carRec['temp_no']; ?>" /> <input name="goods_price" type="hidden" id="goods_price" value="<?php echo $row_carRec['goods_price']; ?>" /> <input type="submit" name="button" id="button" value="修改" /> <input name="del" type="button" id="del" onclick="MM_goToURL('parent','shop_car.php?del=true&amp;temp_no=<?php echo $row_carRec['temp_no']; ?>');return document.MM_returnValue" value="刪除" /></td> <input type="hidden" name="MM_update" value="delform" /> </form> </tr> <?php $total=$total+($row_carRec['ord_num']*$row_carRec['goods_price']); } while ($row_carRec = mysql_fetch_assoc($carRec)); ?> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td><div align="right"><strong>總計NT$</strong></div></td> <td><div align="left"><?php echo $total; ?></div></td> </tr> </table> <?php } // Show if recordset not empty ?> <input name="button2" type="button" id="button2" onclick="MM_goToURL('parent','shop_index.php');return document.MM_returnValue" value="繼續購物" /> <?php if ($totalRows_carRec > 0) { // Show if recordset not empty ?> <input name="button3" type="button" id="button3" onclick="MM_goToURL('parent','shop_order.php');return document.MM_returnValue" value="立即送出" /> <?php } // Show if recordset not empty ?> <br /> </div></td> 能幫我看看哪裡有bug嗎? 謝謝 --



※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.17.9.105
1F:→ tkdmaf:等你不會把dreamweaver產生的原始碼po上來時。 11/04 07:33
2F:→ tkdmaf:我想應該比較會有人來幫你解你的問題。 11/04 07:33
3F:→ angelmark:好難看 11/04 09:37
4F:噓 UniFish:不知道 11/04 10:05
5F:噓 yanli2:不能,不客氣。 11/04 15:31
6F:→ MOONRAKER:本來想說貼到editor 裡面看看到底怎樣的 11/04 18:06
7F:推 cokellen:BUG就是, 你用DW做了不該做的事 11/04 22:38
8F:→ MOONRAKER:…結果看到有11頁就放棄。上班時間沒那麼閒。 11/05 00:40
9F:→ shadowjohn:看到這種code style難怪有人要一直加班... 11/05 02:48







like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草

請輸入看板名稱,例如:BuyTogether站內搜尋

TOP