//==B=======================================================================

  $sql = "select * from tb_number where num_type='b' and num_clear='Yes' order by num_created desc"; 
  $Query = mysqli_query($link,$sql);
  $num_rows = mysqli_num_rows($Query);

  if($num_rows){

  	$count = 0;
	$text_tpye = "";

  echo "
	<table class='table table-bordered'>
    <thead>
    <tr>
    <th bgcolor='default'><center>ลำดับ</th>
    <th bgcolor='default'><center>ตัวเลข</th>
    <th bgcolor='default'><center>เลขตัวต็ง</th>
    <th bgcolor='default'><center>เลขตัวโต็ด</th>
    <th bgcolor='default'><center>วันที่ซื้อ</th>
    <th bgcolor='default'><center>ประเภท</th>
    </tr>
    </thead>
    <tbody>";

	while($Result = mysqli_fetch_array($Query)){
		$num_id = $Result['num_id'];
		$num_buy = $Result['num_buy'];
		$num_one = $Result['num_one'];
		$num_two = $Result['num_two'];
		$num_type = $Result['num_type'];
		$num_created = $Result['num_created'];

		$count = $count+1;

		if($num_type == 'a'){
			$text_tpye = "ประเภทเลข 2 ตัว";
		}
		elseif($num_type == 'b'){
			$text_tpye = "ประเภทเลข 3 ตัว";
		}
		elseif($num_type == 'c'){
			$text_tpye = "ประเภทเลขวิ่ง";
		}
		elseif($num_type == 'd'){
			$text_tpye = "ประเภทเลขใบ";
		}
		else{
			$text_tpye = "ไม่พบข้อมูล";
		}

		echo"<tr>
        <td align='center'>$count</td>
        <td align='center'>$num_buy</td>
        <td align='center'>$num_one</td>
        <td align='center'>$num_two</td>
        <td align='center'>$num_created</td>
        <td align='center'>$text_tpye</td>
      </tr>";

	} // while

	echo "</tbody></table>";
  } // if

  //==C=======================================================================

  $sql = "select * from tb_number where num_type='c' and num_clear='Yes' order by num_created desc"; 
  $Query = mysqli_query($link,$sql);
  $num_rows = mysqli_num_rows($Query);

  if($num_rows){

  	$count = 0;
	$text_tpye = "";

  echo "
	<table class='table table-bordered'>
    <thead>
    <tr>
    <th bgcolor='default'><center>ลำดับ</th>
    <th bgcolor='default'><center>ตัวเลข</th>
    <th bgcolor='default'><center>เลขวิ่งบน</th>
    <th bgcolor='default'><center>เลขวิ่งล่าง</th>
    <th bgcolor='default'><center>วันที่ซื้อ</th>
    <th bgcolor='default'><center>ประเภท</th>
    </tr>
    </thead>
    <tbody>";

	while($Result = mysqli_fetch_array($Query)){
		$num_id = $Result['num_id'];
		$num_buy = $Result['num_buy'];
		$num_one = $Result['num_one'];
		$num_two = $Result['num_two'];
		$num_type = $Result['num_type'];
		$num_created = $Result['num_created'];

		$count = $count+1;

		if($num_type == 'a'){
			$text_tpye = "ประเภทเลข 2 ตัว";
		}
		elseif($num_type == 'b'){
			$text_tpye = "ประเภทเลข 3 ตัว";
		}
		elseif($num_type == 'c'){
			$text_tpye = "ประเภทเลขวิ่ง";
		}
		elseif($num_type == 'd'){
			$text_tpye = "ประเภทเลขใบ";
		}
		else{
			$text_tpye = "ไม่พบข้อมูล";
		}

		echo"<tr>
        <td align='center'>$count</td>
        <td align='center'>$num_buy</td>
        <td align='center'>$num_one</td>
        <td align='center'>$num_two</td>
        <td align='center'>$num_created</td>
        <td align='center'>$text_tpye</td>
      </tr>";

	} // while

	echo "</tbody></table>";
  } // if

  //==D=======================================================================

  $sql = "select * from tb_number where num_type='d' and num_clear='Yes' order by num_created desc"; 
  $Query = mysqli_query($link,$sql);
  $num_rows = mysqli_num_rows($Query);

  if($num_rows){

  	$count = 0;
	$text_tpye = "";

  echo "
	<table class='table table-bordered'>
    <thead>
    <tr>
    <th bgcolor='default'><center>ลำดับ</th>
    <th bgcolor='default'><center>ตัวเลข</th>
    <th bgcolor='default'><center>เลขบน</th>
    <th bgcolor='default'><center>เลขล่าง</th>
    <th bgcolor='default'><center>วันที่ซื้อ</th>
    <th bgcolor='default'><center>ประเภท</th>
    </tr>
    </thead>
    <tbody>";

	while($Result = mysqli_fetch_array($Query)){
		$num_id = $Result['num_id'];
		$num_buy = $Result['num_buy'];
		$num_one = $Result['num_one'];
		$num_two = $Result['num_two'];
		$num_type = $Result['num_type'];
		$num_created = $Result['num_created'];

		$count = $count+1;

		if($num_type == 'a'){
			$text_tpye = "ประเภทเลข 2 ตัว";
		}
		elseif($num_type == 'b'){
			$text_tpye = "ประเภทเลข 3 ตัว";
		}
		elseif($num_type == 'c'){
			$text_tpye = "ประเภทเลขวิ่ง";
		}
		elseif($num_type == 'd'){
			$text_tpye = "ประเภทเลขใบ";
		}
		else{
			$text_tpye = "ไม่พบข้อมูล";
		}

		echo"<tr>
        <td align='center'>$count</td>
        <td align='center'>$num_buy</td>
        <td align='center'>$num_one</td>
        <td align='center'>$num_two</td>
        <td align='center'>$num_created</td>
        <td align='center'>$text_tpye</td>
      </tr>";

	} // while

	echo "</tbody></table>";
  } // if