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 > แก้ไขข้อมูลแล้วไม่ update หน้าแก้ไขอ่ะ ทำไมพอเชื่อมตารางที่list/menu แล้วพอแก้ไขแล้วมันไม่ update



 

แก้ไขข้อมูลแล้วไม่ update หน้าแก้ไขอ่ะ ทำไมพอเชื่อมตารางที่list/menu แล้วพอแก้ไขแล้วมันไม่ update

 



Topic : 015425

Guest




หน้าแก้ไขอ่ะ ทำไมพอเชื่อมตารางที่list/menu แล้วพอแก้ไขแล้วมันไม่updateข้อมูลอ่ะคะ ผิดตรงไหนอ่ะ

<select name="select">
<?php
do {
?>
<option value="<?php echo $row_Rsregis['company_id']?>"<?php if (!(strcmp($row_Rsregis['company_id'], $row_Rsregis['Emp_ID']))) {echo "SELECTED";} ?>><?php echo $row_Rsregis['company_name']?></option>
<?php
} while ($row_Rsregis = mysql_fetch_assoc($Rsregis));
$rows = mysql_num_rows($Rsregis);
if($rows > 0) {
mysql_data_seek($Rsregis, 0);
$row_Rsregis = mysql_fetch_assoc($Rsregis);
}
?>
</select>


Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 3 ก.ย. 2550 15:22:53 By : บ้าแล้ว View : 1594 Reply : 6
 

 

No. 1

Guest


-*-

ทำไมคนสมัยนี้เขียน logic กันแปลก ๆ หว่า

<select name="select">
<?do { ?>
<option value="<?=$row_Rsregis['company_id']?>"<? if ($row_Rsregis['company_id'] == 'ค่าที่ดึงมาจากตาราง'){echo "SELECTED";} ?>>

<?php echo $row_Rsregis['company_name']?>
</option>

<?} while ($row_Rsregis = mysql_fetch_assoc($Rsregis));
$rows = mysql_num_rows($Rsregis);
if($rows > 0) {
mysql_data_seek($Rsregis, 0);
$row_Rsregis = mysql_fetch_assoc($Rsregis);
}
?>
</select>






Date : 3 ก.ย. 2550 15:31:32 By : Thenetxx AE111
 


 

No. 2

Guest


แก้ตามที่บอกแล้วแต่มันดันโชว์ชื่อแค่คนเดียวเลย ไม่ว่าจะแก้คนไหนมันก้อขึ้นชื่อให้แก้คนเดียวเลยอ่ะ ทำไงดี
Date : 3 ก.ย. 2550 15:50:24 By : บ้าจิงๆ
 

 

No. 3

Guest


-*-
แล้วทำไมใช้ do while ล่ะคับ

$sql = 'select .....';
$rs = mysql_query();
echo '<select name="select">';
while($row = mysql_fetch_array($rs)){
if($row[type_id] == 'ค่าที่ดึงจาก db')
echo '<option ... selected>'
else
echo '<option ...>';
}
echo '</select>'
Date : 3 ก.ย. 2550 15:58:08 By : Thenetxx AE111
 


 

No. 4

Guest


ตอนนี้แก้เป็นอย่างนี้แล้วมันไม่ขึ้นข้อมูลอารายเลย ช่วยหน่อยดถอะนะคะ อย่าพึ่งรำคาญเลย เพิ่งเริ่มทำเอง
ลองดู code ทั้งหมดเลยแล้วกัน
<?php require_once('../Connections/db_register.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form_update")) {
$updateSQL = sprintf("UPDATE register SET Thai_Name=%s, Eng_Name=%s, Company_Id=%s, Email=%s, Password=%s, Date_In=%s, Date_Operate=%s, Type_Id=%s, Contect=%s, Comment=%s WHERE Emp_ID=%s",
GetSQLValueString($_POST['Thai_Name'], "text"),
GetSQLValueString($_POST['Eng_Name'], "text"),
GetSQLValueString($_POST['Company'], "int"),
GetSQLValueString($_POST['e-mail'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['Date_In'], "date"),
GetSQLValueString($_POST['Date_Operate'], "date"),
GetSQLValueString($_POST['type'], "int"),
GetSQLValueString($_POST['contect'], "text"),
GetSQLValueString($_POST['comment'], "text"),
GetSQLValueString($_POST['key_Emp_ID'], "text"));

mysql_select_db($database_db_register, $db_register);
$Result1 = mysql_query($updateSQL, $db_register) or die(mysql_error());

$updateGoTo = "updateok.php?Emp_Id=" . $row_Rsregis['Emp_ID'] . "";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}

$colname_Rsregis = "1";
if (isset($_GET['Emp_ID'])) {
$colname_Rsregis = (get_magic_quotes_gpc()) ? $_GET['Emp_ID'] : addslashes($_GET['Emp_ID']);
}
mysql_select_db($database_db_register, $db_register);
$query_Rsregis = sprintf("SELECT * FROM register,company,type WHERE Emp_ID = '%s' and register.company_id=company.company_id and register.type_id=type.type_id ", $colname_Rsregis);
$Rsregis = mysql_query($query_Rsregis, $db_register) or die(mysql_error());
$row_Rsregis = mysql_fetch_assoc($Rsregis);
$totalRows_Rsregis = mysql_num_rows($Rsregis);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/head_tem.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Head_Tem</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.style3 {font-size: 14; font-weight: bold; }
-->
</style>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body,td,th {
font-family: MS Sans Serif;
font-size: 12px;
}
body {
background-image: url();
background-color: #bcf6fa;
}
-->
</style></head>

<body>
<table width="1024" height="151" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="81" colspan="6"><img src="../image/head(green).jpg" width="1024" height="103"></td>
</tr>
<!-- InstanceBeginEditable name="heading" -->
<tr>
<td width="264" height="31"><img src="../image/b_&#3649;&#3585;&#3657;&#3652;&#3586;(&#3648;&#3586;&#3637;&#3618;&#3623;).jpg" width="214" height="58"></td>
<td width="152">&nbsp;</td>
<td width="152"><a href="Search.php"><img src="../image/&#3588;&#3657;&#3609;&#3627;&#3634;(&#3648;&#3586;&#3637;&#3618;&#3623;).jpg" width="155" height="50" border="0"></a></td>
<td width="152"><a href="show_file.php"><img src="../image/&#3649;&#3626;&#3604;&#3591;&#3586;&#3657;&#3629;&#3617;&#3641;&#3621;(&#3648;&#3586;&#3637;&#3618;&#3623;).jpg" width="155" height="50" border="0"></a></td>
<td width="152"><a href="insert.php"><img src="../image/&#3648;&#3614;&#3636;&#3656;&#3617;&#3586;&#3657;&#3629;&#3617;&#3641;&#3621;(&#3648;&#3586;&#3637;&#3618;&#3623;).jpg" width="155" height="50" border="0"></a></td>
<td width="152"><a href="logout.php"><img src="../image/logout(&#3648;&#3586;&#3637;&#3618;&#3623;).jpg" width="155" height="50" border="0"></a></td>
</tr>
<!-- InstanceEndEditable -->
<tr>
<td height="39">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<!-- InstanceBeginEditable name="Details" -->
<p>&nbsp;</p>
<form action="<?php echo $editFormAction; ?>" method="POST" name="form_update" id="form_update">
<table width="652" height="412" border="1" align="center" cellpadding="1" cellspacing="1" bgcolor="#9DFDE8">
<tr>
<td width="139"><div align="right">&#3619;&#3627;&#3633;&#3626;&#3614;&#3609;&#3633;&#3585;&#3591;&#3634;&#3609; : </div></td>
<td width="500"><input name="Emp_ID" type="text" id="Emp_ID" value="<?php echo $row_Rsregis['Emp_ID']; ?>"></td>
</tr>
<tr>
<td><div align="right">&#3594;&#3639;&#3656;&#3629;-&#3626;&#3585;&#3640;&#3621; (&#3652;&#3607;&#3618;) : </div></td>
<td><input name="Thai_Name" type="text" id="Thai_Name" value="<?php echo $row_Rsregis['Thai_Name']; ?>" size="50"></td>
</tr>
<tr>
<td><p align="right">&#3594;&#3639;&#3656;&#3629;-&#3626;&#3585;&#3640;&#3621; (Eng) : </p>
</td>
<td><input name="Eng_Name" type="text" id="Eng_Name" value="<?php echo $row_Rsregis['Eng_Name']; ?>" size="50"></td>
</tr>
<tr>
<td><div align="right">&#3610;&#3619;&#3636;&#3625;&#3633;&#3607; / BU : </div></td>
<td><select name="select">
<?php do { ?>
<option value="<?php $row_Rsregis['company_id']?>"<?php if ($row_Rsregis['company_id']) {echo "SELECTED";} ?>>
<?php echo $row_Rsregis['company_name']?>
</option>
<?php } while ($row_Rsregis = mysql_fetch_assoc($Rsregis));
$rows = mysql_num_rows($Rsregis);
if($rows > 0) {
mysql_data_seek($Rsregis, 0);
$row_Rsregis = mysql_fetch_assoc($Rsregis);
}
?>
</select></td>
</tr>
<tr>
<td><div align="right">E-mail : </div></td>
<td><input name="e-mail" type="text" id="e-mail" value="<?php echo $row_Rsregis['Email']; ?>"></td>
</tr>
<tr>
<td><div align="right">password : </div></td>
<td><input name="password" type="text" id="password" value="<?php echo $row_Rsregis['Password']; ?>"></td>
</tr>
<tr>
<td><div align="right">&#3623;&#3633;&#3609;&#3607;&#3637;&#3656;&#3619;&#3633;&#3610; : </div></td>
<td><input name="Date_In" type="text" id="Date_In" value="<?php echo $row_Rsregis['Date_In']; ?>"></td>
</tr>
<tr>
<td><div align="right">&#3623;&#3633;&#3609;&#3607;&#3637;&#3656;&#3604;&#3635;&#3648;&#3609;&#3636;&#3609;&#3585;&#3634;&#3619; : </div></td>
<td><input name="Date_Operate" type="text" id="Date_Operate" value="<?php echo $row_Rsregis['Date_Operate']; ?>"></td>
</tr>
<tr>
<td><div align="right">&#3611;&#3619;&#3632;&#3648;&#3616;&#3607;&#3607;&#3637;&#3656;&#3586;&#3629; : </div></td>
<td><input name="type" type="text" id="type" value="<?php echo $row_Rsregis['Type_Id']; ?>"></td>
</tr>
<tr>
<td><div align="right">&#3648;&#3610;&#3629;&#3619;&#3660;&#3605;&#3636;&#3604;&#3605;&#3656;&#3629; : </div></td>
<td><input name="contect" type="text" id="contect" value="<?php echo $row_Rsregis['Contect']; ?>"></td>
</tr>
<tr>
<td><div align="right">&#3619;&#3634;&#3618;&#3621;&#3632;&#3648;&#3629;&#3637;&#3618;&#3604; : </div></td>
<td><textarea name="comment" cols="50" rows="5" id="comment"><?php echo $row_Rsregis['Comment']; ?></textarea></td>
</tr>
</table>
<p align="center">
<input name="save" type="submit" id="save" value="&#3610;&#3633;&#3609;&#3607;&#3638;&#3585;">
<input name="cancle" type="reset" id="cancle" value="&#3618;&#3585;&#3648;&#3621;&#3636;&#3585;">
</p>
<p>&nbsp; </p>


<input type="hidden" name="MM_update" value="<?php echo $row_Rsregis['Emp_ID']; ?>">
<input name="key_Emp_ID" type="hidden" id="key_Emp_ID" value="<?php echo $row_Rsregis['Emp_ID']; ?>">
<input type="hidden" name="MM_update" value="form_update">
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($Rsregis);
?>

Date : 3 ก.ย. 2550 16:34:30 By : ขอบคุณนะคะ
 


 

No. 5

Guest


มีวิธีทำง่ายกว่านี้ตั้งเยอะ ลองทำหลายๆๆ แบบ
Date : 3 ก.ย. 2550 17:02:22 By : ...
 


 

No. 6

Guest


ไป coppy ใครมาอ่ะ เห่อๆๆ
Date : 4 ก.ย. 2550 14:42:01 By : 5555
 

   

ค้นหาข้อมูล


   
 

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