thieumao

Lay ket qua voi so ngay dinh truoc

Dec 8th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.91 KB | None | 0 0
  1. <?php
  2. $vung     = $_GET["vung"];
  3. $limit    = $_GET["limit"];
  4. $mangxoso = array(
  5.     "xo-so-binh-duong",
  6.     "xo-so-tp-ho-chi-minh",
  7.     "xo-so-binh-thuan",
  8.     "xo-so-ca-mau",
  9.     "xo-so-dong-thap",
  10.     "xo-so-bac-lieu",
  11.     "xo-so-ben-tre",
  12.     "xo-so-dong-nai",
  13.     "xo-so-soc-trang",
  14.     "xo-so-can-tho",
  15.     "xo-so-an-giang",
  16.     "xo-so-vung-tau",
  17.     "xo-so-binh-phuoc",
  18.     "xo-so-hau-giang",
  19.     "xo-so-kien-giang",
  20.     "xo-so-lam-dong",
  21.     "xo-so-tay-ninh",
  22.     "xo-so-tra-vinh",
  23.     "xo-so-vinh-long",
  24.     "xo-so-tien-giang",
  25.     "xo-so-long-an",
  26.     "xo-so-da-nang",
  27.     "xo-so-quang-nam",
  28.     "xo-so-khanh-hoa",
  29.     "xo-so-dac-lac",
  30.     "xo-so-binh-dinh",
  31.     "xo-so-dac-nong",
  32.     "xo-so-gia-lai",
  33.     "xo-so-kon-tum",
  34.     "xo-so-ninh-thuan",
  35.     "xo-so-phu-yen",
  36.     "xo-so-quang-binh",
  37.     "xo-so-quang-ngai",
  38.     "xo-so-quang-tri",
  39.     "xo-so-thua-thien-hue",
  40.     "xo-so-mien-bac"
  41. );
  42.  
  43. function XuLyChuoi($strInput)
  44. {
  45.     $xuly = $strInput;
  46.     $xuly = str_replace("-", "", $xuly);
  47.     $xuly = str_replace(" ", "", $xuly);
  48.     $xuly = substr($xuly, 4);
  49.     return $xuly;
  50. }
  51. ;
  52.  
  53. function HienThi($vung, $limit)
  54. {
  55.     //$xuly = $strInput;
  56.     $conn = mysql_connect("localhost", "root", "admin") or die("can't connect this database");
  57.     mysql_select_db("appxoso", $conn);
  58.     //$limit = 5;
  59.     $sql    = "SELECT * FROM $vung ORDER BY pid DESC LIMIT $limit";
  60.     $result = mysql_query($sql);
  61.     $stt    = 0;
  62.     while ($row = mysql_fetch_array($result)) {
  63.         $xulykq = str_replace(" ", "", $row["ketqua"]);
  64.         $xulytg = str_replace(" ", "", $row["thoigian"]);
  65.         $stt++;
  66.         echo "$stt - $xulykq - $xulytg";
  67.         echo "<br>";
  68.     }
  69. }
  70. ;
  71.  
  72. for ($i = 0; $i < count($mangxoso); $i++) {
  73.     //$vungmang = XuLyChuoi($mangxoso[$i]);
  74.     if (strcasecmp($mangxoso[$i], $vung) == 0) {
  75.         HienThi(str_replace("-", "", $mangxoso[$i]), $limit);
  76.     }
  77. }
  78. ?>
Advertisement
Add Comment
Please, Sign In to add comment