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

HOME > PHP > PHP Forum > ช่วยแก้โค๊ดอัพเดต 2 ตารางให้ผมหน่อยครับ คือมันแก้ได้แค่ตารางแรกตารางเดียว แต่ตารางที่สองไม่แก้ให้ ปล.ตาราง1และ2ข้อมูลเหมือนกัน



 

ช่วยแก้โค๊ดอัพเดต 2 ตารางให้ผมหน่อยครับ คือมันแก้ได้แค่ตารางแรกตารางเดียว แต่ตารางที่สองไม่แก้ให้ ปล.ตาราง1และ2ข้อมูลเหมือนกัน

 



Topic : 057909



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



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




<HTML>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>แ้ก้ไขจดหมาย</title>
<BODY>
<center>
<?
$id=$_POST[id];
$doctype=$_POST[doctype];
$iddoc=$_POST[iddoc];
$name=$_POST[name];
$lastname=$_POST[lastname];
$status=$_POST[status];

echo "$doctype";
echo "$iddoc";
echo "$name";
echo "$lastname";
echo "$id";




//$mounth_app=$_POST[month];
//$y_app=$_POST[year];

include"connect.php";
$sql="update email set doctype='$doctype',iddoc='$iddoc',name='$name',lastname='$lastname',status='$status' where id='$id'";
$sql2="update update email2 set doctype='$doctype',iddoc='$iddoc',name='$name',lastname='$lastname',status='$status' where id='$id'";
$result=mysql_db_query($dbname,$sql);
$result2=mysql_db_query($dbname,$sql2);

if($result) {
echo"<br><br><h3>บันทึกข้อมูลเรียบร้อยแล้ว</h3>";
echo "<meta http-equiv='refresh' content='1;url=../letter/letter_view.php'>" ;
//echo"<A HREF='letter_view.php'>แสดงข้อมูล</A>";
}

else {
echo"<br><br>";
echo"<h3>ERROR : ไม่สามารถบันทึกข้อมูลได้</h3>";
echo "<meta http-equiv='refresh' content='1;url=../letter/letter_view.php'>" ;
}

?>
</center>
</BODY>
</HTML>



Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-03-28 04:22:30 By : เด็กกระทิง View : 755 Reply : 7
 

 

No. 1



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

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

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

Code (PHP)
$result=mysql_db_query($dbname,$sql);
echo $sql;
$result2=mysql_db_query($dbname,$sql2);
echo $sql;

exit();


ลองเอา SQL Statement มาดูหน่อยครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-03-28 06:00:53 By : webmaster
 


 

No. 2



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



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


<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>
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-03-28 18:12:59 By : เด็กกระทิง
 

 

No. 3



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

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

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

ทำตามความคิดเห็นที่ 2 น่ะครับ จะได้รู้ว่า error เพราะอะไรครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-03-28 20:56:00 By : webmaster
 


 

No. 4



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



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


มันไม่Error คับพี่ แต่เพราะข้อมูล ตาราง1 และ ตารางสอง มันลำดับไม่เท่ากัน คับ
พี่win พอจะแก้ไขได้ไหมครับ

ข้างล่างกระทู้นี้เป็นโค้ดหน้าแก้ไขคับ


ประวัติการแก้ไข
2011-03-30 01:01:01
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-03-30 00:58:31 By : เด็กกระทิง
 


 

No. 5



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



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


<HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>แสดงจดหมาย</title>
</head>
<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>
<form name="frmSearch" method="get" action="Search_1.php" target="_blank">
<table width="500" border="0"align="center">
<tr>
<th>ค้นหาจดหมาย
<input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>">
<input type="submit" value="Search" onClick="check2()" >
<input type="button" value="Reset" OnClick="document.frmSearch.txtKeyword.value='';">
</th>

</tr>
</table>

<script language="JavaScript">
function check2() {
if(document.frmSearch.txtKeyword.value=="") {
alert("กรุณากรอกข้อมูลที่ต้องการค้นหาด้วยครับ") ;
document.frmSearch.txtKeyword.focus() ;
return false ;
}
else
return true ;
}


</script>

</form>

<p>
<?
include "connect.php";
$sql="select * from email order by id desc ";
$result=mysql_db_query($dbname,$sql);
//$row=mysql_num_rows($result);
$Num_Rows = mysql_num_rows($result);
$Per_Page = 80; // Per Page

$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}

$Prev_Page = $Page-1;
$Next_Page = $Page+1;

$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}

$sqlq="select * from email order by id desc limit $Page_Start , $Per_Page ";
$qresult=mysql_db_query($dbname,$sqlq);

echo"<br>";
echo "
<a href='letter_view3.php'><font color='#0443AA'><b>[จัดการข้อมูลสมาชิก]</a></font> <a href='../webboard/login.php'><font color='#0443AA'>[เว็บบอร์ด]</a></font></b>
<a href=adminlogout.php><font color='#0443AA'><b>[ออกจากระบบ]</a></font></b><p>

<table width='800' border='0'><tr><td align='left'><b><font size='2' face='MS Sans Serif'color='#0443AA'>จำนวนข้อมูลทั้งหมด $Num_Rows: จากทั้งหมด $Num_Pages หน้า</td></b></font> <td align='right'><b><font size='2' face='MS Sans Serif'color='#0443AA'> หน้า $Page</td></b></font></tr></table>

<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>";
?>
<?
while($record=mysql_fetch_array($qresult))
{
$id=$record[id];
$iddoc=$record[iddoc];
$name=$record[name];
$lastname=$record[lastname];
$doctype=$record[doctype];
$day=$record[day];
$status=$record[status];

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>";
?>
<center>

<b><font size='3' face='MS Sans Serif'color='#0443AA'>หน้า </font> </b>:
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_GET[txtKeyword]'><< Back</a>";
}

for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='letter_view?Page=$i&txtKeyword=$_GET[txtKeyword]'>$i</a> ]";
}
else
{
echo "<b><font color='#0443AA'> $i</font> </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='letter_view?Page=$Next_Page&txtKeyword=$_GET[txtKeyword]'>Next>></a> ";
}

?>
</center>
</center>
</center>
<br>
<br>
<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>


ประวัติการแก้ไข
2011-03-30 01:01:25
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-03-30 01:00:04 By : เด็กกระทิง
 


 

No. 6



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

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

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


Code (PHP)
$sql="update email set doctype='$doctype',iddoc='$iddoc',name='$name',lastname='$lastname',status='$status' where id='$id'";
$sql2="update update email2 set doctype='$doctype',iddoc='$iddoc',name='$name',lastname='$lastname',status='$status' where id='$id'";
$result=mysql_db_query($dbname,$sql) or die(mysql_error() . '<br />' . $sql);
$result2=mysql_db_query($dbname,$sql2) or die(mysql_error() . '<br />' . $sql2);


แก้เป็นนี่แทนจะได้รู้ว่า error ไหม แล้วโพสต์โค๊ดครั้งต่อไปขอความกรุณาครอบ php code ด้วยครับ จะได้อ่านง่ายๆ คนจะได้ตอบเยอะๆ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-03-30 01:10:14 By : PlaKriM
 


 

No. 7



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



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


คับขอบคุณ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-03-31 00:12:02 By : เด็กกระทิง
 

   

ค้นหาข้อมูล


   
 

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