<?php include_once "./header.php"; include_once "./commonlib.php"; $conn = getConnection("ibabymall"); $ary = getSourceCountList($conn); $source_ary = getSourceList(); /* process page */ ?> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>#</th> <th>商城</th> <th>商品數量</th> </tr> </thead> <tbody> <?php for ($i = 0; $i < sizeof($ary); $i++) { echo "<tr>" . "<td>" . $ary[$i][0] . "</td>" . "<td>" . $source_ary[$ary[$i][0]] . "</td>" . "<td>" . $ary[$i][1] . "</td>"; } ?> </tbody> </table> <?php include_once "footer.php"; ?>
function getStoreData($conn, $id) { $sql = "SELECT * FROM store WHERE id={$id}"; $result = mysql_query($sql, $conn) or die('MySQL query error ' . mysql_error() . ' ' . $sql); $row = mysql_fetch_array($result); $sql = "SELECT count(*) FROM product WHERE store_id={$id}"; $result = mysql_query($sql, $conn) or die('MySQL query error ' . mysql_error() . ' ' . $sql); $row['source'] = getSourceList()[$row['source']]; $row['count'] = mysql_fetch_array($result)[0]; return $row; }
function getStoreData($conn, $store_id) { $sql = "SELECT store.* FROM store where id={$store_id}"; $result = mysql_query($sql, $conn) or die('MySQL query error ' . mysql_error() . ' ' . $sql); $ary = mysql_fetch_array($result); mysql_free_result($result); $sql = "SELECT count(*) FROM product where store_id={$store_id}"; $result = mysql_query($sql, $conn) or die('MySQL query error ' . mysql_error() . ' ' . $sql); $temp = mysql_fetch_array($result); $ary['count'] = $temp[0]; $ary['source'] = getSourceList()[$ary['source']]; mysql_free_result($result); return $ary; }
<?php include_once "./commonlib.php"; $conn = getConnection("ibabymall"); $ary = getStarStore2($conn, 1); $sary = getSourceList($conn); ?> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href=""> <title>麗嬰房資料分析</title> <!-- Bootstrap core CSS --> <link href="./assets/css/bootstrap.min.css" rel="stylesheet" media="screen"> <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <link href="./assets/jasny-bootstrap/css/jasny-bootstrap.min.css" rel="stylesheet" media="screen"> <link href="./assets/sb-admin-2.css" rel="stylesheet"> <link href="./assets/timeline.css" rel="stylesheet"> <link href="./assets/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> <link href="./assets/c3.css" rel="stylesheet" type="text/css"> <script src="./assets/js/typeahead.bundle.js"></script> <!-- Custom styles for this template --> <link href="./assets/dashboard.css" rel="stylesheet"> <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
echo $end_date; ?> "/> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> <div class='col-md-6'> <div class="form-group"> <label>商城</label> <select id="select_source" name="source" class="form-control"> <option value='0'>全部</option> <?php $source = getSourceList(); foreach ($source as $v => $s) { echo "<option value='{$v}'>{$s}</option>"; } ?> </select> </div> </div> <div class='col-md-6'> <div id="store" class="form-group"> <label>店家</label> <select id="select_store" name="store" class="form-control"> <option value='0'>全部</option> <?php $star = getStarStore($conn, "1"); for ($i = 0; $i < sizeof($star); $i++) {