Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > ใช้ page-break ยังไงครับ พอดีผมใช้ while loop แต่อยากให้1หน้า โชว์15ข้อมูลแล้วขึ้นหน้าใหม่ รบกวนดูโค้ดให้หน่อยนะครับ


[PHP] ใช้ page-break ยังไงครับ พอดีผมใช้ while loop แต่อยากให้1หน้า โชว์15ข้อมูลแล้วขึ้นหน้าใหม่ รบกวนดูโค้ดให้หน่อยนะครับ

 
Topic : 127643



โพสกระทู้ ( 11 )
บทความ ( 0 )



สถานะออฟไลน์



ใช้ page-break ยังไงครับ พอดีผมใช้ while loop แต่อยากให้1หน้า โชว์15ข้อมูลแล้วขึ้นหน้าใหม่

whileeee

Code (PHP)
001.<?php
002.include("conn.php");
003.?>
004. 
005.<?php
006.include 'check_ADMIN.php'
007.?>
008. 
009.<!doctype html>
010.<html>
011.<head>
012.<meta charset="utf-8">
013.<title>E-POST System NSRU</title>
014.<link rel="icon" href="favicon.ico" type="image/x-icon">
015.<style type="text/css">
016.p.MsoNormal {margin-top:0cm;
017.margin-right:0cm;
018.margin-bottom:10.0pt;
019.margin-left:0cm;
020.line-height:200%;
021.font-size:11.0pt;
022.font-family:"Calibri","sans-serif";
023.}
024.</style>
025.</head>
026. 
027.<body OnLoad="window.print();">
028.<?php
029.$name=$_GET["name"];
030.$sname=$_GET["sname"];
031.$year=$_GET["year"];
032.$Month=$_GET["Month"];
033.$x=$_GET["x"];
034.if ($name == "" && $sname == "" && $year== "" && $Month == "")
035.{
036.    $head = "";
037.}
038.else if ($name != "" && $sname == "" && $year== "%" && $Month == "%")
039.{
040.    $head = "คุณ&nbsp;".$name;
041.}
042.else if ($name != "" && $sname != "" && $year== "%" && $Month == "%")
043.{
044.    $head = "คุณ&nbsp;".$name."&nbsp;".$sname;
045.}
046.else if ($name == "" && $sname == "" && $year=="%" && $Month != "%")
047.{
048.    $head = "เดือน&nbsp;".$Month;
049.}
050.else if ($name == "" && $sname == "" && $year!= "%" && $Month == "%")
051.{
052.    $head = "ปี&nbsp;".$year;
053.}
054.else if ($name != "" && $sname == "" && $year=="%" && $Month != "%")
055.{
056.    $head = "คุณ&nbsp;".$name."&nbsp;เดือน&nbsp;".$Month;
057.}
058.else if ($name != "" && $sname != "" && $year=="%" && $Month != "%")
059.{
060.    $head = "คุณ&nbsp;".$name."&nbsp;".$sname."&nbsp;&nbsp;เดือน&nbsp;".$Month;
061.}
062.else if ($name != ""&& $sname == ""  && $year!="%" && $Month == "%")
063.{
064.    $head = "คุณ&nbsp;".$name."&nbsp;&nbsp;ปี&nbsp;".$year;
065.}
066.else if ($name != ""&& $sname != ""  && $year!="%" && $Month == "%")
067.{
068.    $head = "คุณ&nbsp;".$name."&nbsp;".$sname."&nbsp;&nbsp;ปี&nbsp;".$year;
069.}
070.else if ($name == "" && $sname == "" && $year!="%" && $Month != "%")
071.{
072.    $head = "เดือน&nbsp;".$Month."&nbsp;&nbsp;ปี&nbsp;".$year;
073.}
074.else if ($name != "" && $sname == "" && $year!= "%" && $Month != "%")
075.{
076.    $head = "คุณ&nbsp;".$name."&nbsp;&nbsp;เดือน&nbsp;".$Month."&nbsp;&nbsp;ปี&nbsp;".$year;
077.}
078.else if ($name != "" && $sname != "" && $year!= "%" && $Month != "%")
079.{
080.    $head = "คุณ&nbsp;".$name."&nbsp;".$sname."&nbsp;&nbsp;เดือน&nbsp;".$Month."&nbsp;&nbsp;ปี&nbsp;".$year;
081.}
082.?>
083.<form id="form1" name="form1" method="post">
084.  <table width="100%" border="0">
085.    <tbody>
086.      <tr>
087.      <td align="center">
088.        <p class="MsoNormal" align="center" style="text-align:center;"><strong><span style="line-height:100%; font-family:'TH SarabunPSK','sans-serif'; font-size:20.0pt; "><img src="image/trademark_nsru.png" width="170" height="80" alt=""/></span></strong></p>
089.         <p class="MsoNormal" align="center" style="text-align: center; font-weight: bold; font-style: normal;"><span style="line-height: 30pt; font-family: 'TH SarabunPSK','sans-serif'; font-size: 20pt; color: black; font-style: normal; font-weight: bold;">รายงานข้อมูลพัสดุ<br> ระบบลงทะเบียนรับ - ส่งจดหมาย (e-post) มหาวิทยาลัย <br> <?php echo $head?> </span></strong></span></p>
090. 
091.                
092.          <table width="1000" border="0">
093.          <tbody>
094.            <tr>
095.              <td><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
096.                <tbody>
097.                 <tr class="table table-hover">
098.                    <td width="15%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt; font-weight: bold;">รหัสพัสดุ</td>
099.                    <td width="15%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt; font-weight: bold;">วันที่รับเข้า</td>
100.                    <td width="15%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt; font-weight: bold;">วันที่นำจ่าย</td>
101.                    <td width="12%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt; font-weight: bold;">ชื่อผู้ส่งพัสดุ</td>
102.                    <td width="8%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt; font-weight: bold;">สถานะ</td>
103.                    <td width="12%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt; font-weight: bold;">ประเภท</td>
104.                    <td width="12%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt; font-weight: bold;">ชื่อผู้รับพัสดุ</td>
105.                    <td width="25%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt; font-weight: bold;">ผู้รับเเทน</td>
106.                  </tr>
107.                 
108.<?php
109.$sql="SELECT parcles.parcle_id, parcles.parcle_dt_get, parcles.parcle_dt_send, parcles.parcle_from, parcles.parcle_tel,parcles.parcle_status,parcles.parcle_getreplaced,parcles.member_id,parcles.type_id, members.member_id,members.member_name, members.member_surname From parcles JOIN members ON parcles.member_id = members.member_id JOIN type ON parcles.type_id = type.type_id
110.WHERE  $x ";
111.$result =mysqli_query($conn,$sql);
112.if(mysqli_num_rows($result)>0){ //เป็นPHPเป็นการเลือกตารางจากdbเก็บที่sql และ เก็บฐานข้อมูลไว้ที่ result จากนั้นกำหนดค้าถ้าแถวมากกว่า0เป็นจริงก็จะแสดง
113.    while($array=mysqli_fetch_array($result)){ //whileถ้ามีข้อมูลให้ทำเป็นการวนloopเอา{ไปไว้หน้าelseอีก1ครั้งเพราะเป็นของไวน์ เฟสอาเรย์(เก็บข้อมูลได้เยอะ)คือการอ่านข้อมูลทีละเเถว
114.    $parcle_id =$array['parcle_id'];
115.    $parcle_dt_get =$array['parcle_dt_get'];
116.    $parcle_dt_send =$array['parcle_dt_send'];
117.    $parcle_from =$array['parcle_from'];
118.    $parcle_tel =$array['parcle_tel'];
119.    $parcle_status =$array['parcle_status'];
120.    $parcle_getreplaced =$array['parcle_getreplaced'];
121.    $member_id =$array['member_id'];
122.    $member_name =$array['member_name'];
123.    $member_surname =$array['member_surname'];
124.    $type_id =$array['type_id'];
125.?>
126. 
127.<tr>
128.      <td height="25%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt"><?php echo $parcle_id; ?></td>
129.      <td height="25%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt"><?php echo $parcle_dt_get; ?></td>
130.      <td align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt"><?php echo $parcle_dt_send; ?></td>
131.      <td height="25%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt"><?php echo $parcle_from; ?></td>
132.     <td height="25%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt"><?php if($parcle_status==1)echo "<font color='blue'>รอนำจ่าย</font>"; if($parcle_status==2)echo "<font color='green'>นำจ่ายแล้ว</font>"; ?></td>
133. 
134.      <?php
135.$sql2="SELECT type_id, type_name  FROM type WHERE type_id=$type_id";
136.$query2=mysqli_query($conn,$sql2);
137.$array2=mysqli_fetch_array($query2); //ใช้ได้ทั้งarrayและassoc
138.    $t_id= $array2['type_id'];
139.    $t_name= $array2['type_name'];
140.?>
141.      <td height="25%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt"><?php echo $t_name; ?></td>
142.      <td height="20%" align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt"><?php echo $member_name;?> <?php echo $member_surname;?></td>
143.      <td align="center" style="font-style: normal; font-family: 'TH SarabunPSK','sans-serif'; font-size: 16pt"><?php echo $parcle_getreplaced; ?></td>
144.      </tr>
145.    <!--เป็น HTML ของแถวที่ 2 -->
146.     
147.    <?php
148.    }}else{
149.        echo "ไม่มีข้อมูลในฐานข้อมูล";
150.        }
151.    ?>
152.        </table>
153.        <p class="MsoNormal" align="center" style="text-align:center;"><br><br><br>&nbsp;</p></td>
154.      </tr>
155.    </tbody>
156.  </table>
157.          <h3 class="MsoNormal" align="center" style="margin-bottom:.0001pt;text-align:center;">&nbsp;</h3>
158.          <p>&nbsp;</p>
159.        </form>
160.</body>
161.</html>




Tag : PHP, HTML, HTML5



ประวัติการแก้ไข
2017-05-17 21:44:55
2017-05-17 21:44:56
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2017-05-17 21:40:49 By : charoen57 View : 927 Reply : 1
 

 

No. 1



โพสกระทู้ ( 5,105 )
บทความ ( 4 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


หาพวก html to pdf มาช่วยดีกว่าครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-05-18 13:11:28 By : apisitp
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ใช้ page-break ยังไงครับ พอดีผมใช้ while loop แต่อยากให้1หน้า โชว์15ข้อมูลแล้วขึ้นหน้าใหม่ รบกวนดูโค้ดให้หน่อยนะครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่