查看文件: body_myproduct.php
大小: 6.22 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <?php if ( isset($_GET["deleteid"]) ) { $delSQL = sprintf("delete from product_data where company_num='%s' AND mem_auto='%s'",$_SESSION['login_coid'],$_GET["deleteid"]); mysql_select_db($database_BE2, $BE2); mysql_query($delSQL, $BE2) or die(mysql_error()); $delSQL2 = sprintf("delete from product_size where duid='%s' AND mid='%s'",$_SESSION['login_coid'],$_GET["deleteid"]); mysql_select_db($database_BE2, $BE2); mysql_query($delSQL2, $BE2) or die(mysql_error()); $write='資料已更新...'; $insertGoTo = "myproduct.html" ; // header(sprintf("Location: %s", $insertGoTo)); echo "<script>alert('".$write."');</script>"; } $currentPage = "myproduct.html";//$_SERVER["PHP_SELF"]; $maxRows_Rt2 = 10; $pageNum_Rt2 = 0; if (isset($_GET['pageNum_Rt2'])) { $pageNum_Rt2 = $_GET['pageNum_Rt2']; } $startRow_Rt2 = $pageNum_Rt2 * $maxRows_Rt2; $colname_Rt2 = "-1"; if (isset($_SESSION['login_memid'])) { $colname_Rt2 = $_SESSION['login_memid']; } mysql_select_db($database_BE2, $BE2); $query_Rt2 = sprintf("SELECT * FROM product_data WHERE p_new>0 AND company_num= '%s' ORDER BY mem_auto DESC",$_SESSION['login_coid']); $query_limit_Rt2 = sprintf("%s LIMIT %d, %d", $query_Rt2, $startRow_Rt2, $maxRows_Rt2); $Rt2 = mysql_query($query_limit_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); //echo $query_Rt2; if (isset($_GET['totalRows_Rt2'])) { $totalRows_Rt2 = $_GET['totalRows_Rt2']; } else { $all_Rt2 = mysql_query($query_Rt2); $totalRows_Rt2 = mysql_num_rows($all_Rt2); } $totalPages_Rt2 = ceil($totalRows_Rt2/$maxRows_Rt2)-1; $queryString_Rt2 = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Rt2") == false && stristr($param, "menu") == false && stristr($param, "totalRows_Rt2") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Rt2 = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Rt2 = sprintf("&totalRows_Rt2=%d%s", $totalRows_Rt2, $queryString_Rt2); ?> <div class="main "> <div class="row"> <div class="col-lg-12"> <p><a style="cursor: pointer" ><b><font color="blue">產品資訊</font></b></a> </p> <a href="productadd.html" class="btn btn-3d btn-blue btn-md">新增產品資訊</a> <a href="#" class="btn btn-3d btn-red btn-md" target="_blank">新增企業產品分類</a></p> <div class="table-responsive"> <form action="product" method="get" name="form44"> <table class="table table-bordered table-hover"> <tbody> <tr> <td>是否上架 <select class="form-control select" name="s1" id="s1"> <option value="">請選擇</option> <option value="上架">上架</option> <option value="下架">下架</option> </select> </td> <td>編號<input name="s4" type="text" id="s4" class="form-control"></td> <td>名稱<input name="s5" type="text" id="s5" class="form-control"></td> <td><br><input type="submit" name="Submit" value="搜尋" class="btn btn-3d btn-black btn-md"></td> </tr> </tbody> </table> </form> </div> <table class="table table-bordered table-striped table-condensed table-hover" style="min-width:900px;"> <thead> <tr> <th>照片</th> <th>上架</th> <th>類別</th> <th>編號</th> <th>名稱</th> <th>價格</th> <th>熱門</th> <th>上架時間</th> <th>下架時間</th> <th>管理</th> </tr> </thead> <tbody> <?php if( $totalRows_Rt2 >0){ do { ?> <tr> <td><a href="/categoryDetail-<?= $row_Rt2['mem_auto']?>.html" target="_blank">1</a></td> <td><?= $row_Rt2['p_check'];?></td> <td><?= '1' ;?></td> <td><?= $row_Rt2['p_num'];?></td> <td><?= $row_Rt2['p_title'];?></td> <td><?= $row_Rt2['p_money'];?></td> <td> </td> <td><?= $row_Rt2['p_check_time'];?></td> <td><?= $row_Rt2['p_check_time2'];?></td> <td> <button type="button" class="label label-info" onclick="javascript:location='productedit-<?= $row_Rt2['mem_auto']; ?>.html'">編輯</button> <? /* <a href="productedit-<?= $row_Rt2['mem_auto']; ?>.html" target="_self">編輯</a> */ ?> <button type="button" class="label label-info" onclick="javascript:if(confirm('確定要刪除嗎?'))location='<?= $currentPage ?>?deleteid=<?= $row_Rt2['mem_auto']; ?>'">刪除</button> </td> </tr> <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); } ?> <tbody> </table> </div> <ul class="pagination"> <? if( $totalPages_Rt2 >0){ //分頁程式 if($totalPages_Rt2<5){ $start=0; $end=$totalPages_Rt2; }else{ $start=$pageNum_Rt2-5; $end=$pageNum_Rt2+5; if ($start<0){ $start=0; $end=10; } else { $end=$start+10 ;} if ($end>$totalPages_Rt2){ $start = $end-$totalPages_Rt2-5; $end=$totalPages_Rt2; } if ($end-$start>10){ $start = $end-10; } } ?> <?php if ($pageNum_Rt2 > 0) { // Show if not first page ?> <li><a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, max(0, $pageNum_Rt2 - 1), $queryString_Rt2); ?>">上一頁</a></li><?php } // Show if not first page ?> <? for($i=$start;$i<=$end;$i++){ if($i==$pageNum_Rt2){ echo '<li class="active"><a href="#">'.($i+1).'</a></li>';} else {?> <li><a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, min($totalPages_Rt2, $i), $queryString_Rt2); ?>"><? echo $i+1 ;?></a></li> <? } } ?> <?php if ($pageNum_Rt2 < $totalPages_Rt2) { // Show if not last page ?> <li><a href="<?php printf("%s?pageNum_Rt2=%d%s", $currentPage, min($totalPages_Rt2, $pageNum_Rt2 + 1), $queryString_Rt2); ?>">下一頁</a></li> <?php } } ?> </ul> </div> </div> <?php mysql_free_result($Rt2); ?>
保存
取消
返回文件列表