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灯, 水草

请输入看板名称,例如:Soft_Job站内搜寻

TOP