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,028

HOME > PHP > PHP Forum > ช่วยดูโค๊ดแบ่งหน้าให้ผมหน่อยครับ คือเวลาเราล็อกอินหรือเพิ่มข้อมูลหรือลบข้อมูลมันจะ error



 

ช่วยดูโค๊ดแบ่งหน้าให้ผมหน่อยครับ คือเวลาเราล็อกอินหรือเพิ่มข้อมูลหรือลบข้อมูลมันจะ error

 



Topic : 057700

Guest




Code (PHP)
<HTML>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>แสดงจดหมาย</title>
<style type="text/css">
<!--
body,td,th {
color: #000000;
}
body {
background-color: #CCCCCC;
}
-->
</style><BODY><center>
<p><img src="../Head/head.gif" width="1000" height="150"> </p>
<p>
<?
include "connect.php";
//$count=0;
$sql="select * from email order by id desc ";
$result=mysql_db_query($dbname,$sql);
echo"<br>";

$numrow = mysql_num_rows($result);

echo "จำนวนข้อมูลที่พบ $numrow ";
//echo "<h3>ระบบจดหมาย</h3>
/*$tpage = round($numrow/30);
$ch = $numrow / 30;
if ($tpage < $ch) {
$tpage++;
}
$tt = ($numrow %30);

$a=1;
for ($i=0;$i<$tpage;$i++) {
$st = ($a-1)*30;
$x = $st;
if ($st == $start) {
$link ="<b><font color=blue>";
$clo ="</b></font>";
}else {
$link ="<a href=letter_view.php?tp=1&type=$type&start=$st&r_ctl=$r_ctl&id=$x>";
$clo ="</a>";
}
echo"$link $a $clo |";
$a++;
}*/

echo "
<a href='letter_view3.php'><font color='#0443AA'><b>[จัดการข้อมูลสมาชิก]</a></font> <a href='../webboard/login.php'><font color='#0443AA'>[เว็บบอร์ด]</a></font></b><p>
<table width='800' border='1'>
<tr bgcolor='color='#0443AA'>
<td width='50'><center><b><font size='2' face='MS Sans Serif'color='#FFFFFF'>ลำดับที่
</font></b></center></td>
<td width='150'><center><b><font size='2' face='MS Sans Serif'color='#FFFFFF'>หมายเลขจดหมาย
</font></b></center></td>
<td width='250'><center><b><font size='2' face='MS Sans Serif'color='#FFFFFF'>ชื่อผู้รับ
</font></b></center></td>
<td width='150'><center><b><font size='2' face='MS Sans Serif'color='#FFFFFF'>ประเภทจดหมาย</font></b></center></td>
<td width='250'><center><b><font size='2' face='MS Sans Serif'color='#FFFFFF'>วันที่ได้รับ
</font></b></center></td>
<td width='100'><center><b><font size='2' face='MS Sans Serif'color='#FFFFFF'>สถานะ
</font></b></center></td>
<td width='100'><center><b><font size='2' face='MS Sans Serif'color='#FFFFFF'>แก้ไข</font></b></center></td>
<td width='100'><center><b><font size='2' face='MS Sans Serif'color='#FFFFFF'>ลบ</font></b></center></td></tr>";
?>
<?
$sql="select * from email order by id desc limit $start,10";
$result=mysql_db_query($dbname,$sql);
while($record=mysql_fetch_array($result)) 
{
//$count++;
$id=$record[id];
$iddoc=$record[iddoc];
$name=$record[name];
$lastname=$record[lastname];
$doctype=$record[doctype];
$day=$record[day];
$status=$record[status];
//$day=$record[day];
//$month=$record[month];
//$year=$record[year];
echo "<tr bgcolor='#FFFFFF'>
<td width='50'><center><font size='2' face='MS Sans Serif'color='#0443AA'>$id</font></center></td>
<td width='150'><center><font size='2' face='MS Sans Serif'color='#0443AA'>$iddoc</font></center></td>
<td width='250'><center><font size='2' face='MS Sans Serif'color='#0443AA'>$name&nbsp; &nbsp;$lastname</font></center></td>
<td width='150'><center><font size='2' face='MS Sans Serif'color='#0443AA'>$doctype</font><center></td>
<td width='250'><center><font size='2' face='MS Sans Serif'color='#0443AA'>$day</font></center></td>
<td width='100'><center><font size='2' face='MS Sans Serif'color='#0443AA'>$status</font></center></td>
<TD width='100'><A HREF=\"letter_edit2.php?id_edit=$id\"onclick=\" return confirm('ยืนยันแก้ไข$name ออกจากระบบ')\"><center>แก้ไข</A></TD></center> 
<TD width='100'><A HREF=\"admin_type_delete.php?id_del=$id\"onclick=\" return confirm('ยืนยันลบ$name ออกจากระบบ')\"><center>ลบ</A></TD></center> 
</tr>";

}
echo "</table>";
echo " รายการหน้าที่";
//echo "<h3>ระบบจดหมาย</h3>
$tpage = round($numrow/10);
$ch = $numrow / 10;
if ($tpage < $ch) {
$tpage++;
}
$tt = ($numrow %10);

$a=1;
for ($i=0;$i<$tpage;$i++) {
$st = ($a-1)*10;
$x = $st;
if ($st == $start) {
$link ="<b><font color=blue>";
$clo ="</b></font>";
}else {
$link ="<a href=letter_view.php?tp=1&type=$type&start=$st&r_ctl=$r_ctl&id=$x>";
$clo ="</a>";
}
echo"$link $a $clo |";
$a++;
}

?>
</p>
<p><a href="adminlogout.php"><center>[ออกจากระบบ]</center><br></a></p>
</center>
</center>
<tr>
<td><h2 align="center" class="style1">&nbsp;</h2>
<h3 align="center" class="style1"><font color="#0000FF">เพิ่มจดหมาย</font></h3>
<form name="checkForm" method="POST" action="letter_save.php" onSubmit="return check()">
<table width="512" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#99FFFF" size ="10">
<tr>
<td>ประเภทจดหมาย</td>
<td><font size="2" face="MS Sans Serif, Tahoma, sans-serif">
<select name=doctype >
<option selected value="">เลือกประเภท</option>
<option value="จดหมาย">จดหมาย</option>
<option value="EMS">EMS</option>
<option value="พัสดุ">พัสดุ</option>
</select>
</font></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="120">หมายเลข</td>
<td width="382"><input name="iddoc" type="text" id="iddoc" size="30" maxlength="13"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>ชื่อ-นามสกุล</td>
<td><label for="name"></label>
<input name="name" type="text" id="name" size="25">
-
<label for="lastname"></label>
<input name="lastname" type="text" id="lastname" size="25"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>วันที่ได้รับ</td>

<td><font size="2" face="MS Sans Serif, Tahoma, sans-serif">
<label for="year"></label>
</font><? 
$c_date = date("d");
$m_app = array ("ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
$mounth_app = $m_app[date("n") - 1];
$y_app = date("Y") + 543;
$c_time = date("H:i");
$day = "$c_date $mounth_app $y_app เวลา$c_time น.";	
?>

<input name="day"type="text" id="day" value="<?=$day ?>"/></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>สถานะ</td>
<td><select name=status >
<option selected value="">เลือกสถานะ</option>
<option value="ยังไม่รับ">ยังไม่รับ</option>
<option value="รับแล้ว">รับแล้ว</option>
</select></td>
</tr>
</table>
<script language="javascript">
function check() {
if(document.checkForm.doctype.value=="") {
alert("กรุณาเลือกประเภท") ;
document.checkForm.doctype .focus() ;
return false ;
}
if(document.checkForm.iddoc.value=="") {
alert("กรุณาใสหมายเลขจดหมาย") ;
document.checkForm.iddoc .focus() ;
return false ;
}
if(document.checkForm.name.value=="") {
alert("กรุณาใส่ชื่อผู้รับ") ;
document.checkForm.doctype .focus() ;
return false ;
}
if(document.checkForm.lastname.value=="") {
alert("กรุณาใส่นามสกุลผู้รับ") ;
document.checkForm.doctype .focus() ;
return false ;
}
if(document.checkForm.status.value=="") {
alert("กรุณาเลือกสถานะ") ;
document.checkForm.doctype .focus() ;
return false ;
}

else 
return true ;
}
</script>
<div align="center"><br>
<input name="submit" type="submit" value="ตกลง">
<input name="reset" type="reset" value="ยกเลิก">
</div>
</form>
</BODY>
</HTML>



มันจะErro rWarning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\Email\letter\letter_view.php on line 70

ดูให้หน่อยครับ แต่ถ้าผมกดตรงเลขหน้ามันจะไม่ฟ้องError ที่มันerror จะมีตอนล็อกอินเข้าระบบเพิ่มและลบข้อมูล



Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-03-23 21:02:01 By : เด็กกระทิง View : 644 Reply : 2
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

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

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

Code (PHP)
$sql="select * from email order by id desc limit $start,10";
$result=mysql_db_query($dbname,$sql) or die(mysql_error());


หรือไม่ลอง echo $sql; ออกมาดูน่ะครับ ว่ามันถูกหรือไม่






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-03-23 21:13:07 By : webmaster
 


 

No. 2

Guest


ไม่ใช่ครับพี่ win มันerrorไม่โชว์ข้อมูล แต่เวลาคลิกที่หน้า2จะโชว์ข้อมูล
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-03-23 21:50:45 By : เด็กกระทิง
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดูโค๊ดแบ่งหน้าให้ผมหน่อยครับ คือเวลาเราล็อกอินหรือเพิ่มข้อมูลหรือลบข้อมูลมันจะ error
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

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