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 > ผมจะทำปุ่มเปลี่ยนสถานะ อ่ะครับ แต่ผมเขียนไม่ถูกอ่ะครับต้องเขียนยังไง ขอบคุณครับ



 

ผมจะทำปุ่มเปลี่ยนสถานะ อ่ะครับ แต่ผมเขียนไม่ถูกอ่ะครับต้องเขียนยังไง ขอบคุณครับ

 



Topic : 107977

Guest




ผมกด เครื่องหมาย ในหน้านี้

Code (PHP)
<?	ob_start();
	session_start();
	include("connect.php");
	
	$query = "UPDATE service2 SET 
	status='pass'
	WHERE id_ser='".$_GET['status']."'";
	mysql_query($query)or die(mysql_error());
	header("Location: report_laundry.php");
?>

ุ62
|
|
|
\/
มันจะไปปรากฏเป็นหน้านีเครับ
63

ผมต้องการกดคำว่า pass ให้เปลี่ยนเป็น เสร็จสิ้น ผมต้องเขียน code ยังไงอ่ะครับ

ขอบคุณล่วงหน้าครับ



Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2014-04-29 13:51:22 By : moomoo View : 9474 Reply : 16
 

 

No. 1



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



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


บรรทัดที่ 5 ครับ
$query = "UPDATE service2 SET
status='pass'

เปลี่ยนเป็น
Code (PHP)
$query = "UPDATE service2 SET
status='เสร็จสิ้น'









ประวัติการแก้ไข
2014-04-29 14:19:28
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 14:19:05 By : dreamt256
 


 

No. 2

Guest


ตอบความคิดเห็นที่ : 1 เขียนโดย : dreamt256 เมื่อวันที่ 2014-04-29 14:19:05
รายละเอียดของการตอบ ::
ผมต้องการ กด ตรงคำว่า pass แล้วให้มันเปลี่ยนเป็น เสร็จสิ้น อ่ะครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 14:31:27 By : moomoo
 

 

No. 3



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

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

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


เอาเพจหน้าที่คุณโชว์คำว่า pass มาดูหน่อย
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 14:47:40 By : apisitp
 


 

No. 4

Guest


หน้านี้อ่ะครับ
Code (PHP)
<br /><div class="title_h" ><strong>รายการของลูกค้า</strong></div><br />
<table width="80%" border="1" cellspacing="2" cellpadding="2" background="img/r1_4.gif">
<tr>
<td style="width:65px;"><div align="center">ลำดับที่</div></td>
<td style="width:60px";><div align="center">ฃื่อผู้ใช้</div></td>

<td><div align="center">วันที่ส่งซัก</div></td>
<td><div align="center">วันที่มารับ</div></td>
<td><div align="center">ราคา (บาท)</div></td>
<td><div align="center">สถานะ</div></td>
<td ><div align="center">พิมพ์</div></td>  
<td><div align="center">ลบ</div></td>
</tr>
<?
include ("connect.php");
$sql_show = "select * from service2 where status ='pass'";
$result_show = mysql_query($sql_show) or die(mysql_error());$i=0;
while($row_show = mysql_fetch_array($result_show))
{
?>
<tr>
<td style="width:45px;"align="center"><?=++$i?></td>
<td align="center"><?=$row_show['id_name']?></td>

<td align="center"><?=$row_show['datein']?></td>
<td align="center"><?=$row_show['dateout']?></td>
<td align="right"><?=$row_show['total']?>.00 บาท </td>
<td align="center"><?=$row_show['status'] ?></td>

<td><div align="center"><a href="print_bill.php?id_ser=<?=$row_show['id_ser']?>" target="_blank"><img src="img/Avosoft-Warm-Toolbar-Print.ico"width="25" height="25" /></a></div></td>
<td align="center"><a href="delete_laundry.php?del_id=<?=$row_show['id_user']?>"onClick="return confirm('ยืนยันการลบข้อมูล')"><img src="img/Delete.png" width="25" height="25" /></a></td>
</tr>
<?
}
?>
</table>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 14:51:15 By : moomoo
 


 

No. 5



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



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


Code (PHP)
<? if($row_show['status']=="pass"){ echo "เสร็จสิ้น";?>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 14:53:50 By : sabaitip
 


 

No. 6

Guest


ตอบความคิดเห็นที่ : 5 เขียนโดย : sabaitip เมื่อวันที่ 2014-04-29 14:53:50
รายละเอียดของการตอบ ::
ถ้าจะทำให้กดเองต้อง ทำยังไงอ่ะครับ แบบนั้นมันเปลี่ยนเองอ่ะครับ

ขอบคุณล่วงหน้าครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 15:09:33 By : moomoo
 


 

No. 7



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



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


ของผมเป็นแบบนี้นะ

คือ มี 2 สถานะ พอกดแล้วจะเปลี่ยนเป็นอีกสถานะ

ลองๆ ดูนะ

Code (PHP)
<?PHP //เปลี่ยนสถานะ
   if($_GET["Action"] == "Change"){

   $dur_id = $_GET['dur_id'];

   $sql = "SELECT * FROM duration WHERE dur_id = '$dur_id'";
   $result = mysql_query($sql);
   $show = mysql_fetch_array($result);

   if($show['dur_status'] == "0"){
      $dur_status = 1;
   }else{
      $dur_status = 0;
   }
   $sql = "UPDATE duration SET dur_status = '$dur_status' WHERE dur_id = '$dur_id'";
   $result = mysql_query($sql);
   }
?>



Code (PHP)
<td><a href="duration.php?Action=Change&dur_id=<?=$show['dur_id'];?>" onclick="return confirm('ยืนยันการเปลี่ยนสถานะ')"><? if($show['dur_status']=='1'){ echo "<font color=\"red\">ปิด</font>";} else { echo "<font color=\"green\">เปิด</font>";}?></a></td>



ประวัติการแก้ไข
2014-04-29 15:22:01
2014-04-29 15:24:09
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 15:21:33 By : sabaitip
 


 

No. 8

Guest


ตอบความคิดเห็นที่ : 7 เขียนโดย : sabaitip เมื่อวันที่ 2014-04-29 15:21:33
รายละเอียดของการตอบ ::
ผมควรเอาไปวางไว้ส่วนไหนอ่ะครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 15:25:16 By : moomoo
 


 

No. 9



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



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


0 = เปิด
1 = ปิด

ของคุณก็เปลี่ยนตามที่ทำ

Code (PHP)
<?PHP //เปลี่ยนสถานะ
   if($_GET["Action"] == "Change"){

   $dur_id = $_GET['dur_id'];

   $sql = "SELECT * FROM duration WHERE dur_id = '$dur_id'";
   $result = mysql_query($sql);
   $show = mysql_fetch_array($result);

   if($show['dur_status'] == "0"){ //ถ้าเป็น 0 ให้เปลี่ยนเป็น 1
      $dur_status = 1;
   }else{ // ถ้าไม่ใช่เงือนไขแรกให้เปลี่ยนเป็น 0
      $dur_status = 0;
   }
   $sql = "UPDATE duration SET dur_status = '$dur_status' WHERE dur_id = '$dur_id'";
   $result = mysql_query($sql);
   }
?>
//ข้างบนก็เปลี่ยนเป็นของคุณ
//รับค่า action=change 

<br /><div class="title_h" ><strong>รายการของลูกค้า</strong></div><br />
<table width="80%" border="1" cellspacing="2" cellpadding="2" background="img/r1_4.gif">
<tr>
<td style="width:65px;"><div align="center">ลำดับที่</div></td>
<td style="width:60px";><div align="center">ฃื่อผู้ใช้</div></td>

<td><div align="center">วันที่ส่งซัก</div></td>
<td><div align="center">วันที่มารับ</div></td>
<td><div align="center">ราคา (บาท)</div></td>
<td><div align="center">สถานะ</div></td>
<td ><div align="center">พิมพ์</div></td>  
<td><div align="center">ลบ</div></td>
</tr>
<?
include ("connect.php");
$sql_show = "select * from service2 where status ='pass'";
$result_show = mysql_query($sql_show) or die(mysql_error());$i=0;
while($row_show = mysql_fetch_array($result_show))
{
?>
<tr>
<td style="width:45px;"align="center"><?=++$i?></td>
<td align="center"><?=$row_show['id_name']?></td>

<td align="center"><?=$row_show['datein']?></td>
<td align="center"><?=$row_show['dateout']?></td>
<td align="right"><?=$row_show['total']?>.00 บาท </td>
<td><a href="duration.php?Action=Change&dur_id=<?=$show['dur_id'];?>" onclick="return confirm('ยืนยันการเปลี่ยนสถานะ')"><? if($show['dur_status']=='1'){ echo "<font color=\"red\">ปิด</font>";} else { echo "<font color=\"green\">เปิด</font>";}?></a></td> // href เป็นชื่อเพจนี้ พวก id ที่ส่งก็เปลี่ยนนะ เป็นของคุณ มันจะส่ง action=change และ id ไป

<td><div align="center"><a href="print_bill.php?id_ser=<?=$row_show['id_ser']?>" target="_blank"><img src="img/Avosoft-Warm-Toolbar-Print.ico"width="25" height="25" /></a></div></td>
<td align="center"><a href="delete_laundry.php?del_id=<?=$row_show['id_user']?>"onClick="return confirm('ยืนยันการลบข้อมูล')"><img src="img/Delete.png" width="25" height="25" /></a></td>
</tr>
<?
}
?>
</table>



ประวัติการแก้ไข
2014-04-29 15:37:02
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 15:34:20 By : sabaitip
 


 

No. 10



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

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

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



แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 15:56:09 By : apisitp
 


 

No. 11

Guest


มันไม่เปลี่ยนให้อะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 16:36:51 By : moomoo
 


 

No. 12



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



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


สถานะคุณเก็บเป็น
"pass" กับ "เสร็จสิ้น" เลยหรือป่าว
ถ้าใช่ผมคิดว่าน่าจะใช้อย่างอื่นแทนดีกว่านะ อย่างเช่นตัวเลข

Code (PHP)
<?PHP //เปลี่ยนสถานะ
       if($_GET["Action"] == "Change"){

       $id_ser = $_GET['id_ser'];

       $sql = "SELECT * FROM service2 WHERE id_ser = '$id_ser'";
       $result = mysql_query($sql);
       $row_show = mysql_fetch_array($result);

       if($row_show['status'] == "pass"){
          $status = "เสร็จสิ้น";
       }else{
          $status = "pass";
       }
       $sql = "UPDATE service2 SET status = '$status' WHERE id_ser = '$id_ser'";
       $result = mysql_query($sql);
       }
    ?>

    <br /><div class="title_h" ><strong>รายการของลูกค้า</strong></div><br />
    <table width="80%" border="1" cellspacing="2" cellpadding="2" background="img/r1_4.gif">
    <tr>
    <td style="width:65px;"><div align="center">ลำดับที่</div></td>
    <td style="width:60px;"><div align="center">ฃื่อผู้ใช้</div></td>

    <td><div align="center">วันที่ส่งซัก</div></td>
    <td><div align="center">วันที่มารับ</div></td>
    <td><div align="center">ราคา (บาท)</div></td>
    <td><div align="center">สถานะ</div></td>
    <td ><div align="center">พิมพ์</div></td>
    <td><div align="center">ลบ</div></td>
    </tr>
    <?
    include ("connect.php");
    $sql_show = "select * from service2 where status ='pass'";
    $result_show = mysql_query($sql_show) or die(mysql_error());$i=0;
    while($row_show = mysql_fetch_array($result_show))
    {
    ?>
    <tr>
    <td style="width:45px;"align="center"><?=++$i?></td>
    <td align="center"><?=$row_show['id_name']?></td>

    <td align="center"><?=$row_show['datein']?></td>
    <td align="center"><?=$row_show['dateout']?></td>
    <td align="right"><?=$row_show['total']?>.00 บาท </td>
    <td><a href="<?=$_SERVER["PHP_SELF"];?>?Action=Change&id_ser=<?=$row_show['id_ser'];?>" onclick="return confirm('ยืนยันการเปลี่ยนสถานะ')"><? if($row_show['status']=='pass'){ echo "PASS";} else { echo "เสร็จสิ้น";}?></a></td>

    <td><div align="center"><a href="print_bill.php?id_ser=<?=$row_show['id_ser']?>" target="_blank"><img src="img/Avosoft-Warm-Toolbar-Print.ico"width="25" height="25" /></a></div></td>
    <td align="center"><a href="delete_laundry.php?del_id=<?=$row_show['id_user']?>"onClick="return confirm('ยืนยันการลบข้อมูล')"><img src="img/Delete.png" width="25" height="25" /></a></td>
    </tr>
    <?
    }
    ?>
    </table>



ประวัติการแก้ไข
2014-04-29 19:06:51
2014-04-29 19:07:40
2014-04-29 19:08:47
2014-04-29 19:11:30
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 18:50:56 By : sabaitip
 


 

No. 13

Guest


ทำได้แล้วครับ ขอบคุณทุกคนมากๆๆครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-04-29 21:48:11 By : moomoo
 


 

No. 14

Guest


ผมลองทำตามดูแล้วครับแต่ข้อมูลไม่แสดง แสดงแต่หัวตาราง
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-10-02 14:03:03 By : อาร์ม
 


 

No. 15



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

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

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


แล้วทำไม คุณอาร์ม ไม่สมัครสมาชิก แล้ว ถามเป็นปัญหาของตัวเองครับ อยู่ดีดี " ผมลองทำตามดูแล้วครับแต่ข้อมูลไม่แสดง แสดงแต่หัวตาราง "
มันคืออะไร ยังไงครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-10-02 14:54:21 By : apisitp
 


 

No. 16

Guest


ผมทำการอนุมัติหนังสือ(หนังสือราชการ)ผมต้องการให้ปลี่ยนสถานะต้องทำไงครับ ขอบคุณครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2016-04-17 16:37:50 By : wasa
 

   

ค้นหาข้อมูล


   
 

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