query($sql); if ($row = $rs->fetch()) { $sql = "Update Products Set ProductName='" . $productName . "', ProductImg='" . $productImg . "', Addtime=NOW(), moq='" . $moq . "', unit='" . $unit . "', nosale='" . $nosale . "', note='" . $note . "', tips='" . $tips . "' Where id=" . $id; $conn->query($sql); $conn->query("delete from price where productId=" . $id . " and AreaId=0"); $numarr = explode(",", $num); $pricearr = explode(",", $price); for ($i = 0; $i < count($numarr); $i++) { if ($numarr[$i] == "") $numarr[$i] = 0; if ($pricearr[$i] == "") $pricearr[$i] = 0; $conn->query("insert into price (productId,AreaId,num,price) values(" . $id . ",0," . $numarr[$i] . ",'" . $pricearr[$i] . "')"); } } } else { $sql = "Insert Into Products(ProductName,ProductImg,Addtime,unit,moq,nosale,note,tips) values( '" . $productName . "', '" . $productImg . "', NOW(), '" . $unit . "', '" . $moq . "', '" . $nosale . "', '" . $note . "', '" . $tips . "' )"; $conn->query($sql); $sql = "select top 1 id from Products order by id desc"; $rs = $conn->query($sql); $id = $rs->fetch()['id']; $numarr = explode(",", $num); $pricearr = explode(",", $price); for ($i = 0; $i < count($numarr); $i++) { if ($numarr[$i] == "") $numarr[$i] = 0; if ($pricearr[$i] == "") $pricearr[$i] = 0; $conn->query("insert into price (productId,AreaId,num,price) values(" . $id . ",0," . $numarr[$i] . ",'" . $pricearr[$i] . "')"); } } $page = $_GET['Page'] ?? ''; $keys = urlencode($_GET['Keys'] ?? ''); header("Location: ?keys=" . $keys . "&Page=" . $page . $urlStr); exit; } if ($act == "add" || $act == "edit") { $id = $_GET['id'] ?? ''; $isedit = false; if ($id != "" && is_numeric($id)) { $isedit = true; $sql = "Select ProductName,ProductImg,unit,moq,nosale,note,tips from Products Where id=" . $id; $rs = $conn->query($sql); if ($row = $rs->fetch()) { $productName = textUncode($row['ProductName']); $productImg = textUncode($row['ProductImg']); $unit = $row['unit']; $moq = textUncode($row['moq']); $nosale = $row['nosale']; $note = textUncode($row['note']); $tips = textUncode($row['tips']); } else { $isedit = false; } } $page = $_GET['Page'] ?? ''; $keys = urlencode($_GET['Keys'] ?? ''); $hrefstr = "?keys=" . $keys . "&Page=" . $page; ?>
产品名称
产品图片
计价单位
起订数量
默认售价
query("Select num,price from price where AreaId=0 and productId=" . $id . " order by num asc"); if ($rs->rowCount() > 0) { while ($row = $rs->fetch()) { ?>
不报价地区
    query("select id,countryName from country where id in(" . $nosale . ")"); while ($row = $rs->fetch()) { ?>
    不报价处理方式
    备注
    query($sqlStr); } header("Location: ?Keys=" . $keys . "&Page=" . $page); exit; } // 主列表页面 $keyscode = textEncode($_GET['Keys'] ?? ''); $page = $_GET['Page'] ?? ''; $sqlStr = "Select id,ProductName,ProductImg from Products order by id Desc"; $rs = $conn->query($sqlStr); ?>
    rowCount() > 0) { $rs->setFetchMode(PDO::FETCH_ASSOC); $records_per_page = 18; if ($page == "") $page = 1; if ($page == "end") $page = ceil($rs->rowCount() / $records_per_page); if (!is_numeric($page) || $page < 1) $page = 1; $page = (int)$page; $start = ($page - 1) * $records_per_page; $tempNum = $start; $count = 0; while ($row = $rs->fetch()) { $count++; if ($count > $start && $count <= $start + $records_per_page) { $tempNum++; ?>
    序号 产品名称 图片 操作
    修改
    Sorry,当前暂无信息
    Sorry,没有找到""相关的信息,点击返回
    rowCount() > 0) { $total_pages = ceil($rs->rowCount() / $records_per_page); if ($total_pages > 1) { $pageName = "?Keys=" . urlencode($_GET['Keys'] ?? '') . ($urlStr ?? '') . "&"; $pagelen = 3; if ($page > 1) { echo "首页"; echo "上一页"; } if ($pagelen * 2 + 1 >= $total_pages) { $startPage = 1; $endPage = $total_pages; } else { if ($page <= $pagelen + 1) { $startPage = 1; $endPage = $pagelen * 2 + 1; } else { $startPage = $page - $pagelen; $endPage = $page + $pagelen; } if ($page + $pagelen > $total_pages) { $startPage = $total_pages - $pagelen * 2; $endPage = $total_pages; } } for ($i = $startPage; $i <= $endPage; $i++) { if ($i == $page) { echo "$i"; } else { echo "$i"; } } if ($page < $total_pages) { if ($total_pages - $page > $pagelen) { echo "...$total_pages"; } echo "下一页"; echo "尾页"; } echo ""; } } ?>