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 > ช่วยดูให้หน่อยค่ะ ลบ(delete)ข้อมูลในตารางไม่ได้ค่ะ



 

ช่วยดูให้หน่อยค่ะ ลบ(delete)ข้อมูลในตารางไม่ได้ค่ะ

 



Topic : 119586



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



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




ทำไมถึง ลบในตารางไม่ได้คะ
หน้าserver_add.php
Code (PHP)
<? 
include "header.php";

	if(isset($_SESSION['ssPermission'])){
	
	if(($_SESSION['ssPermission']==admin)||($_SESSION['ssPermission']==operator)){ ?>
    
<link href="css/jquery-ui.css" rel="stylesheet" type="text/css"/>
<link href="css/css.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" media="all" type="text/css" href="css/jquery-ui-timepicker-addon.css" />
<script type="text/javascript" src="css/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="css/jquery-ui.min.js"></script>
<script type="text/javascript" src="css/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="css/jquery-ui-sliderAccess.js"></script>
<script type="text/javascript">
	$(function() {
		$("#date").datetimepicker();
	});

    </script>

<script type="text/javascript">
	$(function() {
		$("#date2").datetimepicker();
	});

    </script>

<script>
function setOptions(chosen) {
		var selbox = document.inf_form.br_id;
 
		selbox.options.length = 0;
		if (chosen == " ") {
	  		selbox.options[selbox.options.length] = new Option('please select company from above first',' ');
 		}
			
}
</script>

<div id="container" align="center">
	<div id="searchForm" align="right">
		<form id="search" name="frmSearchCustomer" method="get" action="<? echo $_SESSION['SCRIPT_NAME']; ?>">
			<input type="text" name="txtKeyword" id="txtKeyword" value="<? echo $_GET['txtKeyword']; ?>" placeholder="Search...">
		</form>
	</div>
	<div id="main">
		<div id="bodyHead">
			Server Add
		</div>
		<br/>
      <form id="server_form" name="server_form"   method="post" action="server_addProcess.php">
    	<table width="751" border="0" >
              
                     
       <tr>
         <td width="113">&nbsp;</td>
         <td width="238">&nbsp;</td>
       </tr>
              <tr>
                <td height="33">&nbsp;</td>
                <td>หน่วยงาน</td>
                <td width="21">:</td>
                <td width="280"><label>
		    <select id="t_location" name="t_location">
			<option value=""> --- select --- </option>
			<?php
			$strSQL = "SELECT * FROM tn_printerlocation ORDER BY LocationType ASC";
			$objQuery = mysql_query($strSQL);
			while($objResuut = mysql_fetch_array($objQuery))
			{
				if($strDefault == $objResuut["LocationType"])
				{
					$sel = "selected";
				}
				else
				{
					$sel = "";
				}
			?>
			<option value="<?php echo $objResuut["LocationType"];?>" <?php echo $sel;?>><?php echo $objResuut["LocationType"]." - ".$objResuut["LocationName"];?></option>
			<?php
			}
			?>
         
		  </select>
                
               </label>                
                <td width="47">&nbsp;</td>
              </tr> 
                
                
                <tr>
                <td height="34">&nbsp;</td>
                <td>ได้รับแจ้งเรื่อง</td>
                <td>:</td>
                <td><input type="text" name="t_inform" id="t_inform" width="200"/></td>
                <td>&nbsp;</td>
                <td width="26">&nbsp;</td>
              </tr>
                
            
            <tr>
			<td height="34">&nbsp;</td>
                			<td>การแก้ไข (อธิบาย)</td>
                			<td>:</td>
			<td><textarea name="t_edit" id="t_edit" cols=30 row=20 maxlength="200"></textarea></td>
			<td>&nbsp;</td>
            
            
            
            
              
              <tr>
                <td height="34">&nbsp;</td>
                <td>รายการอุปกรณ์
                ที่เบิกใช้(ถ้ามี)</td>
               
                <td>:</td>
                <td><input type="text" name="t_tool" id="t_tool" width="200"/></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              
		  
            <tr>
			<td height="34">&nbsp;</td>
                			<td>บันทึกอื่นๆเพิ่มเติม</td>
                			<td>:</td>
			<td><textarea name="t_note" id="t_note" cols=30 row=20 maxlength="150"></textarea></td>
			<td>&nbsp;</td>
              
              
               <tr>
                <td height="33">&nbsp;</td>
                <td>สถานะ</td>
                <td width="21">:</td>
                <td width="280"><label>
		    <select id="t_status" name="t_status">
			<option value=""> --- select --- </option>
			<?php
			$strSQL = "SELECT * FROM  status ORDER BY status_id ASC";
			$objQuery = mysql_query($strSQL);
			while($objResuut = mysql_fetch_array($objQuery))
			{
				if($strDefault == $objResuut["status_id"])
				{
					$sel = "selected";
				}
				else
				{
					$sel = "";
				}
			?>
			<option value="<?php echo $objResuut["status_id"];?>" <?php echo $sel;?>><?php echo $objResuut["status_id"]." - ".$objResuut["status_name"];?></option>
			<?php
			}
			?>
         
		  </select>
                
               </label>    
               
               
                           
                <td width="47">&nbsp;</td>
              </tr>  
              <tr>
                <td height="34">&nbsp;</td>
                <td>ผู้ดำเนินการแก้ไข</td>
               
                <td>:</td>
                <td><input type="text" name="t_name" id="t_name" width="200"/></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              
              
			<td height="34">&nbsp;</td>
                			<td>วันที่บันบึก</td>
                			<td>:</td>
			<td><input type="text" name="t_date" id="date" width="200" placeholder="dd/mm/yyyy" /></td>
		  	<td height="34">&nbsp;</td>
              
              <tr>
              
              
              	<td height="34">&nbsp;</td>
                			<td>วันที่แก้ไข</td>
                			<td>:</td>
			<td><input type="text" name="t_dateedit" id="date2" width="200" placeholder="dd/mm/yyyy" /></td>
		  	<td height="34">&nbsp;</td>
              
              <tr>
                <td height="21">&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td colspan="3"><div align="center">
                      <label>
			<button class="buttonOk" type="submit" onmouseover="style.cursor='pointer';">Save</button>
                  </label>
                  <label>
			<button class="buttonReset" type="reset" onmouseover="style.cursor='pointer';">Reset</button>
                  </label>


                </div></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td colspan="3">&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            </table>
      </form>
	</div>

<? 		} else 
		{ 
		 include "permission_message.php"; 
		} 	//if - check permission
	} else 
	{ 
	include "login_message.php";	
	} 		//else - check login
?>
		<br/>
	</div>
</div>

<? 
include "footer.php"; 
?>


หน้าserver_addprocess
Code (PHP)
<? 
include "header.php";

	if(isset($_SESSION['ssPermission'])){

	if(($_SESSION['ssPermission']==admin)||($_SESSION['ssPermission']==operator)){ ?>

<div id="container" align="center">
	<div id="searchForm" align="right">
		<form id="search" name="frmSearchCustomer" method="get" action="<? echo $_SESSION['SCRIPT_NAME']; ?>">
			<input type="text" name="txtKeyword" id="txtKeyword" value="<? echo $_GET['txtKeyword']; ?>" placeholder="Search...">
		</form>
	</div>
	<div id="main">
		<div id="bodyHead">
			Accessory Add
		</div>
		<br/>
		<div>
<?
	mysql_query("set NAMES utf-8");
	
	$t_location=$_POST['t_location'];
	$t_inform=$_POST['t_inform'];
	$t_edit=$_POST['t_edit'];
	$t_tool=$_POST['t_tool'];
	$t_note=$_POST['t_note'];
	$t_status=$_POST['t_status'];
	$t_name=$_POST['t_name'];
	
	$a=explode(" ",$_POST['t_date']);
	$b=explode("/",$a[0]);
	$day=$b[2]."-".$b[0]."-".$b[1];
	$time=$a[1];
	$t_date=$day." ".$time;
	
	$c=explode(" ",$_POST['t_dateedit']);
	$d=explode("/",$c[0]);
	$day2=$d[2]."-".$d[0]."-".$d[1];
	$time2=$c[1];
	$t_dateedit=$day2." ".$time2;
		
	 $sql="select * from server where t_inform='".$t_inform."' and t_location='".$t_location."'";
	$val = mysql_query($sql);
	$num_rows = mysql_num_rows($val);
	if($num_rows==0){
		
	$sql = "insert into server values ('','".$t_location."', '".$t_inform."', '".$t_edit."','".$t_tool."','".$t_note."','".$t_status."','".$t_name."','".$t_date."','".$t_dateedit."')";
	$result = mysql_query($sql);

	if ($result)
	{
	$txt="add server ip=".$t_location;
	$sqllog ="insert into log values ('','".$_SESSION['ssUsername']."','".$txt."','".date('Y-m-d H:i:s')."')";	
	$resultlog = mysql_query($sqllog);	
?>

	<table width="600" border="0">
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>           
               <tr>
                <td width="150" height="24">&nbsp;</td>
                <td width="100">หน่วยงาน</td>
                <td width="20">:</td>
                <td width="205"><? echo $t_location; ?></td>
                <td width="150">&nbsp;</td>
              </tr>
              <tr>
                <td height="24">&nbsp;</td>
                <td>ได้รับแจ้งเรื่อง</td>
                <td>:</td>
                <td><? echo $t_inform; ?></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td height="24">&nbsp;</td>
                <td>การแก้ไข (อธิบาย)</td>
                <td>:</td>
                <td><? echo $t_edit; ?></td>
                <td>&nbsp;</td>
              </tr>  
		<tr>
                <td height="24">&nbsp;</td>
                <td>รายการอุปกรณ์
                ที่เบิกใช้(ถ้ามี)</td>
                <td>:</td>
                <td><? echo $t_tool; ?></td>
                <td>&nbsp;</td>
              </tr>  
              
              
              <tr>
                <td height="24">&nbsp;</td>
                <td>บันทึกอื่นๆเพิ่มเติม</td>
                <td>:</td>
                <td><? echo $t_note; ?></td>
                <td>&nbsp;</td>
              </tr>  
              <tr>
                <td height="24">&nbsp;</td>
                <td>สถานะ</td>
                <td>:</td>
                <td><? echo $t_status; ?></td>
                <td>&nbsp;</td>
              </tr>  
              <tr>
                <td height="24">&nbsp;</td>
                <td>ผู้ที่ดำเนินการแก้ไข</td>
                <td>:</td>
                <td><? echo $t_name; ?></td>
                <td>&nbsp;</td>
              </tr>  
              <tr>
                <td height="24">&nbsp;</td>
                <td>วันที่บันบึก</td>
                <td>:</td>
                <td><? echo $t_date; ?></td>
                <td>&nbsp;</td>
              </tr>  
              
              <tr>
                <td height="24">&nbsp;</td>
                <td>วันที่แก้ไข</td>
                <td>:</td>
                <td><? echo $t_dateedit; ?></td>
                <td>&nbsp;</td>
              </tr>  
            </table>

		<br/>
		<br/>

		<script>
		function link(){
   		   location.href="server_show.php";
		}
		alert('Add complete.');
		link();
		</script>
<?
	}else	{	
		echo "Can not add. Please try again.";
		echo "<br>"; }  
?>
		<br/>
		<label><a href="server_add.php"><button class="buttonOk" type="submit" onMouseOver="style.cursor='pointer';">Back</button></a></label>
                  	<label><a href="server_show.php"><button class="buttonReset" type="reset" onMouseOver="style.cursor='pointer';">Cancel</button></a></label>
		<br/>
		<br/>

<? 	} 

	 	} else 
		{ 
		 include "permission_message.php"; 
	 	}  	//if - check permission
	} else 
	{ 
	include "login_message.php"; 
	} 		//else - check login
?>

		<br/>
	</div>
</div>





หน้า server_edit.php
Code (PHP)
<? 
include "header.php";
if(isset($_SESSION['ssPermission'])){
if(($_SESSION['ssPermission']==admin)||($_SESSION['ssPermission']==operator)){ 
	$sql = "select * from server where t_id='".$_GET['t_id']."' ";
		$val = mysql_query($sql);
		$res = mysql_fetch_array($val);

?>
 <link href="css/jquery-ui.css" rel="stylesheet" type="text/css"/>
<link href="css/css.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" media="all" type="text/css" href="css/jquery-ui-timepicker-addon.css" />
<script type="text/javascript" src="css/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="css/jquery-ui.min.js"></script>
<script type="text/javascript" src="css/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="css/jquery-ui-sliderAccess.js"></script>
<script type="text/javascript">
	$(function() {
		$( "#datepicker" ).datepicker();
	});

    </script> 
    
    <script type="text/javascript">
	$(function() {
		$( "#datepicker2" ).datepicker();
	});

    </script> 
    
<script type="text/javascript">
	$(function() {
		$("#date").datetimepicker();
	});

    </script>

<script type="text/javascript">
	$(function() {
		$("#date2").datetimepicker();
	});

    </script>

<script>
function setOptions(chosen) {
		var selbox = document.inf_form.br_id;
 
		selbox.options.length = 0;
		if (chosen == " ") {
	  		selbox.options[selbox.options.length] = new Option('please select company from above first',' ');
 		}
			
}
</script>

<div id="container" align="center">
	<div id="searchForm" align="right">
		<form id="search" name="frmSearchCustomer" method="get" action="<? echo $_SESSION['SCRIPT_NAME']; ?>">
			<input type="text" name="txtKeyword" id="txtKeyword" value="<? echo $_GET['txtKeyword']; ?>" placeholder="Search...">
		</form>
	</div>
	<div id="main">
		<div id="bodyHead">
			Server Edit
		</div>
		<br/>

       <form id="server_form" name="server_form" method="post" action="server_editProcess.php">
    	<table width="600" border="0">
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
         <td width="113">&nbsp;</td>
         <td width="238">&nbsp;</td>
       </tr>
              <tr>
                <td height="33">&nbsp;</td>
                <td>หน่วยงาน</td>
                <td width="21">:</td>
                <td width="280"><label>
		    <select id="t_location" name="t_location">
			<option value=""> --- select --- </option>
			<?php
			$strSQL = "SELECT * FROM tn_printerlocation ORDER BY LocationType ASC";
			$objQuery = mysql_query($strSQL);
			while($objResuut = mysql_fetch_array($objQuery))
			{
				if($strDefault == $objResuut["LocationType"])
				{
					$sel = "selected";
				}
				else
				{
					$sel = "";
				}
			?>
			<option value="<?php echo $objResuut["LocationType"];?>" <?php echo $sel;?>><?php echo $objResuut["LocationType"]." - ".$objResuut["LocationName"];?></option>
			<?php
			}
			?>
         
		  </select>
                
               </label>                
              
              <tr>
                <td height="34">&nbsp;</td>
                <td>ได้รับแจ้งเรื่อง</td>
                <td>:</td>
                <td><input type="text" name="t_inform" id="t_inform" width="200" value="<? echo $res["t_inform"]; ?>" /></td>
                <td>&nbsp;</td>
              </tr>
		<tr>
                <td height="34">&nbsp;</td>
                <td>การแก้ไข (อธิบาย)</td>
                <td>:</td>
                <td><input type="text" name="t_edit" id="t_edit" width="200" value="<? echo $res["t_edit"];?>"/></td>
                <td>&nbsp;</td>
              </tr>
              
              
              	<tr>
                <td height="34">&nbsp;</td>
                <td>รายการอุปกรณ์
                ที่เบิกใช้(ถ้ามี)</td>
                <td>:</td>
                <td><input type="text" name="t_tool" id="t_tool" width="200" value="<? echo $res["t_tool"];?>"/></td>
                <td>&nbsp;</td>
              </tr>
              
              
              	<tr>
                <td height="34">&nbsp;</td>
                <td>บันทึกอื่นๆเพิ่มเติม</td>
                <td>:</td>
                <td><input type="text" name="t_note" id="t_note" width="200" value="<? echo $res["t_note"];?>"/></td>
                <td>&nbsp;</td>
              </tr>
              
              
           <tr>
                <td height="33">&nbsp;</td>
                <td>สถานะ</td>
                <td width="21">:</td>
                <td width="280"><label>
		    <select id="t_status" name="t_status">
			<option value=""> --- select --- </option>
			<?php
			$strSQL = "SELECT * FROM  status ORDER BY status_id ASC";
			$objQuery = mysql_query($strSQL);
			while($objResuut = mysql_fetch_array($objQuery))
			{
				if($strDefault == $objResuut["status_id"])
				{
					$sel = "selected";
				}
				else
				{
					$sel = "";
				}
			?>
			<option value="<?php echo $objResuut["status_id"];?>" <?php echo $sel;?>><?php echo $objResuut["status_id"]." - ".$objResuut["status_name"];?></option>
			<?php
			}
			?>
         
		  </select>
                
               </label> 
              
              	<tr>
                <td height="34">&nbsp;</td>
                <td>ผู้ที่ดำเนินการแก้ไข</td>
                <td>:</td>
                <td><input type="text" name="t_name" id="t_name" width="200" value="<?php echo $res["t_name"];?>"/></td>
                <td>&nbsp;</td>
              </tr>
              
              	<tr>
                <td height="34">&nbsp;</td>
                <td>วันที่บันบึก</td>
                <td>:</td>
                <td><input type="text" name="t_date" id="date" width="200" value="<?php echo $res["t_date"];?>"/></td>
                <td>&nbsp;</td>
              </tr>
              
              	<tr>
                <td height="34">&nbsp;</td>
                <td>วันที่แก้ไข</td>
                <td>:</td>
                <td><input type="text" name="t_dateedit" id="date2" width="200" value="<?php echo $res["t_dateedit"];?>"/></td>
                <td>&nbsp;</td>
              </tr>
              
    <tr>
                <td><input type="hidden" name="t_id" id="t_id" value="<?php echo $res['t_id']; ?>" width="200"/></td>
              </tr>
              
              
              
              
              
              
              <tr>
                <td height="21">&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td colspan="3"><div align="center">
                      <label>
			<button class="buttonOk" type="submit" onmouseover="style.cursor='pointer';">Save</button>
                  </label>
                  <label>
			<button class="buttonReset" type="reset" onmouseover="style.cursor='pointer';">Reset</button>
                  </label>


                </div></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td colspan="3">&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            </table>
      </form>
	</div>

<? 		} else 
		{ 
		 include "permission_message.php"; 
		} 	//if - check permission
	} else 
	{ 
	include "login_message.php";	
	} 		//else - check login
?>
		<br/>
	</div>
</div>

<? 
include "footer.php"; 
?>


หน้า server_editprocess
Code (PHP)
<? 
include "header.php";
if(isset($_SESSION['ssPermission'])){
if(($_SESSION['ssPermission']==admin)||($_SESSION['ssPermission']==operator)){ 
?>

<div id="container" align="center">
	<div id="searchForm" align="right">
		<form id="search" name="frmSearchCustomer" method="get" action="<? echo $_SESSION['SCRIPT_NAME']; ?>">
			<input type="text" name="txtKeyword" id="txtKeyword" value="<? echo $_GET['txtKeyword']; ?>" placeholder="Search...">
		</form>
	</div>
	<div id="main">
		<div id="bodyHead">
			Server Edit
		</div>
		<br/>
<?
	mysql_query("set NAMES utf-8");
	
	$t_id=$_POST['t_id'];
	$t_location=$_POST['t_location'];
	$t_inform=$_POST['t_inform'];
	$t_edit=$_POST['t_edit'];
	$t_tool=$_POST['t_tool'];
	$t_note=$_POST['t_note'];
	$t_status=$_POST['t_status'];
	$t_name=$_POST['t_name'];
	$t_date=$_POST['t_date'];
	$t_dateedit=$_POST['t_dateedit'];
	
	
	
	
	
	

 	$sql="select * from server where t_id= '".$t_id."'";
	$val = mysql_query($sql);

	$sql = "update server set t_location='".$_POST["t_location"]."',t_inform='".$_POST["t_inform"]."',t_edit='".$_POST["t_edit"]."',t_tool='".$_POST["t_tool"]."',t_note='".$_POST["t_note"]."',t_status='".$_POST["t_status"]."',t_name='".$_POST["t_name"]."',t_date='".$_POST["t_date"]."',t_dateedit='".$_POST["t_dateedit"]."' Where t_id ='".$_POST["t_id"]."' ";
	$result = mysql_query($sql);
	if ($result)
	{
		$txt="Edit server =".$_POST["t_location"]." ";
		$sqllog ="insert into log values ('','".$_SESSION['ssUsername']."','".$txt."','".date('Y-m-d H:i:s')."')";	
		$resultlog = mysql_query($sqllog);
?>

		<table width="600" border="0">
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>           
               <tr>
                <td width="150" height="24">&nbsp;</td>
                <td width="100">หน่วยงาน</td>
                <td width="20">:</td>
                <td width="205"><? echo $_POST['t_location']; ?></td>
                <td width="150">&nbsp;</td>
              </tr>
              <tr>
                <td height="24">&nbsp;</td>
                <td>ได้รับแจ้งเรื่อง</td>
                <td>:</td>
                <td><? echo $_POST['t_inform']; ?></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td height="24">&nbsp;</td>
                <td>การแก้ไข (อธิบาย)</td>
                <td>:</td>
                <td><? echo $_POST['t_edit']; ?></td>
                <td>&nbsp;</td>
              </tr>  
		<tr>
                <td height="24">&nbsp;</td>
                <td>รายการอุปกรณ์
                ที่เบิกใช้(ถ้ามี)</td>
                <td>:</td>
                <td><? echo $_POST['t_tool']; ?></td>
                <td>&nbsp;</td>
              </tr>  
              
              	<tr>
                <td height="24">&nbsp;</td>
                <td>บันทึกอื่นๆเพิ่มเติม</td>
                <td>:</td>
                <td><? echo $_POST['t_note']; ?></td>
                <td>&nbsp;</td>
              </tr>  
              
              	<tr>
                <td height="24">&nbsp;</td>
                <td>สถานะ</td>
                <td>:</td>
               <td><? echo $_POST['t_status']; ?></td>
                <td>&nbsp;</td>
              </tr>  
              
              	<tr>
                <td height="24">&nbsp;</td>
                <td>ผู้ที่ดำเนินการแก้ไข</td>
                <td>:</td>
                <td><? echo $_POST['t_name']; ?></td>
                <td>&nbsp;</td>
              </tr>  
              
              	<tr>
                <td height="24">&nbsp;</td>
                <td>วันที่บันบึก</td>
                <td>:</td>
            <td><? echo $_POST['t_date']; ?></td>
                <td>&nbsp;</td>
              </tr>  
              
              	<tr>
                <td height="24">&nbsp;</td>
                <td>วันที่แก้ไข</td>
                <td>:</td>
               <td><? echo $_POST['t_dateedit']; ?></td>
                <td>&nbsp;</td>
              </tr>  
            </table>

		<br/>
		<br/>
	
<?
	} else
	{
		echo "Error Save [".$sql."]";
	}	//if - else 
?>
		<script>
		function link(){
   		   location.href="server_show.php";
		}
		alert('Data updated.');
		link();
	</script>

<? 		} else 
		{
		include "permission_message.php";
		}	//if - check permission
 
	} else 
	{ 
	 include "login_message.php";
	} 	//else - check login  
?>

		<br/>
	</div>
</div>
<? 
include "footer.php";
?>



หน้า server_show.php
Code (PHP)
<? 
include "header.php";
if(isset($_SESSION['ssPermission'])){
?>

<div id="container" align="center">
	<div id="searchForm" align="right">
		<form id="search" name="frmSearchCustomer" method="get" action="<? echo $_SESSION['SCRIPT_NAME']; ?>">
			<input type="text" name="txtKeyword" id="txtKeyword" value="<? echo $_GET['txtKeyword']; ?>" placeholder="Search...">
		</form>
	</div>
	<div id="main">
		<div id="bodyHead">
			Server Management
		</div>
		<br/>
		<table id="tablesorter" class="zebra" width="80%" heigth="600px">
			<thead>
    				<tr>        
				    <th width="25%">หน่วยงาน</th>
       				<th width="15%">ได้รับแจ้งเรื่อง</th>
					<th width="30%">การแก้ไข (อธิบาย)</th>
					<th width="30%">รายการอุปกรณ์
                ที่เบิกใช้(ถ้ามี)</th>
                     <th width="25%">บันทึกอื่นๆเพิ่มเติม</th>
       				<th width="15%">สถานะ</th>
					<th width="30%">ผู้ที่ดำเนินการแก้ไข</th>
					<th width="30%">วันที่บันบึก</th>
                    <th width="30%">วันที่แก้ไข</th>
                    
                    
                    
                    
					<? if(($_SESSION['ssPermission']==admin)||($_SESSION['ssPermission']==operator)){ ?>
					<th width="10%"><p>Menagement</p>
					  
					<? } ?>
				</tr>
			</thead>
			<tbody>
<? 	

		if($_GET['txtKeyword'] != ""){
			$sql = "select * from server where t_location like '%".$_GET['txtKeyword']."%' or t_inform '%".$_GET['txtKeyword']."%' or t_edit like '%".$_GET['txtKeyword']."%' ";
			$val = mysql_query($sql);
			$num_rows = mysql_num_rows($val);
		}else{
			$sql = "select * from server ";
			$val = mysql_query($sql);
			$num_rows = mysql_num_rows($val);
		}

		while($result = mysql_fetch_array($val))
		{
		echo "<tr>";
		echo	"<td>".$result['t_location']."</td>";
		echo	"<td>".$result['t_inform']."</td>";
		echo	"<td>".$result['t_edit']."</td>";
		echo   "<td>".$result['t_tool']."</td>";
		echo   "<td>".$result['t_note']."</td>";
		echo   "<td>".$result['t_status']."</td>";
		echo   "<td>".$result['t_name']."</td>";
		echo   "<td>".$result['t_date']."</td>";
		echo   "<td>".$result['t_dateedit']."</td>";
if(($_SESSION['ssPermission']==admin)||($_SESSION['ssPermission']==operator)){ 
		echo 	"<td align='center'><a href='server_edit.php?t_id=".$result['t_id']."'><img src='imgs/edit.png' alt='edit' border='0' /></a>&nbsp&nbsp&nbsp<a href='server_delete.php' onclick='del(\"".$result['t_id']."\",\"server\"); return false'><img name='imgDelete' alt='delete' src='imgs/delete.png' border='0'/></a></td>";
		}  	//if
		echo "</tr>";
	}  		//while
?>
			</tbody>
		</table>
		<br/>
	<? include "show.php"; ?>
	</div>
</div>

<? 		} else 
		{
		include "login_message.php";
		} 	//else - check login
?>

		<br/>
	</div>
</div>

<? 
include "footer.php";
?>



หน้า server_delete.php
Code (PHP)
<?
include("config.inc.php");
  	if ($submit=="delete")
	{
		$sql = "Delete From server where t_id = '".$_GET["t_id"]."' ";
		$result = mysql_query($sql);
		if ($result)
		{
		?>
			<script langauge="JavaScript">
				window.location='server_show.php';
			</script>
		<?
		}
		else
			{
			echo "Error Delete [".$sql."]";
			}
	}
?>






ช่วยดูให้หน่อยค่ะ แก้มานานแล้วก็ยังไม่ออก ลบข้อมูลไม่ได้ค่ะ



Tag : PHP, HTML/CSS









ประวัติการแก้ไข
2015-10-27 14:21:48
2015-10-27 14:27:58
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-10-27 14:18:43 By : a_u_m22 View : 660 Reply : 4
 

 

No. 1



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



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


function del() อยู่ตรงไหนหรอครับ

<a href='server_delete.php' onclick='del(\"".$result['t_id']."\",\"server\"); return false'>







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-10-27 14:27:37 By : armdbz
 


 

No. 2



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



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

บันทัด 66 server_show
Code
echo "<td align='center'> <a href='server_edit.php?t_id=".$result['t_id']."'> <img src='imgs/edit.png' alt='edit' border='0' /> </a>&nbsp&nbsp&nbsp <a href='server_delete.php' onclick='del(\"".$result['t_id']."\",\"server\"); return false'> <img name='imgDelete' alt='delete' src='imgs/delete.png' border='0'/> </a></td>";

โค๊ดข้างบน สีแดงกับสีนำเงิน มันทำงานแค่สีแดง เท่านั้น redirect ไปก่อนแล้ว ไม่ทันได้ทำ สีน้ำเงิน

และโค๊ดสีแดง ให้ทำเหมือนกับสีน้ำตาล

ปล. หรืออยากจะใช้ โค๊ดสีน้ำเงินเพื่อทำการตรวจสอบก่อน ( ซึ่งไม่รู้ฟังก์ชั่น del() มันอยู่ไหน ตาม คห1)
เปลี่ยนโค๊ดสีแดง เป็น href="javascript: void()"


ประวัติการแก้ไข
2015-10-28 04:02:56
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-10-28 03:58:13 By : NewbiePHP
 

 

No. 3

Guest


ไม่เห็นมี Delete เลย ครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-10-28 09:49:08 By : tercool
 


 

No. 4

Guest


Code
<? include("config.inc.php"); <==== ไม่แน่ใจตรงนี้คืออะไรครับ if ($submit=="delete") { $sql = "Delete From server where t_id = '".$_GET["t_id"]."' "; $objExecute = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $result = mysql_query($sql); if ($result) { ?> <script langauge="JavaScript"> window.location='server_show.php'; </script> <? } else { echo "Error Delete [".$sql."]"; } mysql_close(); } ?>



ลองดูตามนี้ครับ 2 ที่ ไม่แน่ใจนะครับ แต่ แนะนำ ดูนิดนึงครับ มันเชื่อมไปไหน
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-10-28 10:10:41 By : tercool
 

   

ค้นหาข้อมูล


   
 

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