|
 |
|
ค่าว่างในตาราง เวลาแพรเพิ่มข้อมูลลงในตารางแล้วกดบันทึกมันจะเพิ่มช่องว่างในตารางมาให้อีกหนึ่งช่อง |
|
 |
|
|
 |
 |
|
ก็ต้องเอาโค๊ด insert into มาดูครับ
อาจจะมีการวน insert ก็ได้
|
 |
 |
 |
 |
Date :
2009-07-15 16:03:36 |
By :
martman26 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถูกต้องครับ ดูไม่ออกจิง ๆ ครับ
รบกวน ขอดูโค้ด หน่อย
|
 |
 |
 |
 |
Date :
2009-07-15 16:17:17 |
By :
taobsd |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เยอะมากๆๆเลยคะ
<?php require_once('Connections/testcon.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
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_insert"])) && ($_POST["MM_insert"] == "forminputdata")) {
$insertSQL = sprintf("INSERT INTO personal (user_id, passw, p_pos, username) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['บุคคลากร'], "int"),
GetSQLValueString($_POST['รหัส'], "text"),
GetSQLValueString($_POST['manu1'], "text"),
GetSQLValueString($_POST['ชื่อ'], "text"));
mysql_select_db($database_testcon, $testcon);
$Result1 = mysql_query($insertSQL, $testcon) or die(mysql_error());
$insertGoTo = "insertok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_testcon, $testcon);
$query_Recordset1 = "SELECT * FROM personal";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $testcon) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
<META http-equiv=Content-Type content="text/html; charset=windows-874">
<style type="text/css">
<!--
.style2 {font-family: Tahoma}
.style3 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; }
.style4 {font-family: Arial, Helvetica, sans-serif}
-->
</style>
<head><title>ระบบรายงานการปฎิบัติงาน</title></head>
<body>
<form action="<?php echo $editFormAction; ?>" method="POST" name="forminputdata" target="_self" id="forminputdata">
<table width="323" border="0" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFCC">
<tr>
<td width="121"> รหัสพนักงาน</td>
<td width="192"><input name="บุคคลากร" type="text" id="บุคคลากร"></td>
</tr>
<tr>
<td>ชื่อผู้ใช้งาน</td>
<td><input name="ชื่อ" type="text" id="ชื่อ"></td>
</tr>
<tr>
<td>ตำแหน่ง</td>
<td><select name="manu1" id="manu1">
<option value="" <?php if (!(strcmp("", $row_rem['p_pos']))) {echo "SELECTED";} ?>>เลือก</option>
<option value="manager" <?php if (!(strcmp("manager", $row_rem['p_pos']))) {echo "SELECTED";} ?>>ผู้บริหาร</option>
<option value="admin" <?php if (!(strcmp("admin", $row_rem['p_pos']))) {echo "SELECTED";} ?>>ผู้ดูแลระบบ</option>
<option value="angineer" <?php if (!(strcmp("angineer", $row_rem['p_pos']))) {echo "SELECTED";} ?>>เจ้าหน้าที่</option>
</select></td>
</tr>
<tr>
<td>รหัสผ่าน</td>
<td><input name="รหัส" type="password" id="รหัส"></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<div align="center">
<input name="Submit1" type="submit" id="Submit1" value="บันทึกข้อมูล">
<input name="Cancel" type="reset" id="Cancel" value="ยกเลิก" />
</div>
</div></td>
<div align="center"></div>
</tr>
</table>
<br>
<input type="hidden" name="MM_insert" value="forminputdata">
</form>
<br>
<form action="deleat.php?stre=<?php echo $row_Recordset1['user_id']; ?>" method="post" name="formoutputdata" target="_blank" id="formoutputdata">
<input name="keydelete" type="hidden" id="keydelete" value="<?php echo $row_Recordset1['user_id']; ?>">
<table width="616" border="1" align="center">
<tr>
<td width="113"><div align="center">รหัสบุคคลากร</div></td>
<td width="167"><div align="center">ชื่อผู้ใช้งาน</div></td>
<td width="169"><div align="center">ตำแหน่ง</div></td>
<td width="92"><div align="center">รหัสผ่าน</div></td>
<td width="53"><div align="center"></div></td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['user_id']; ?></td>
<td><?php echo $row_Recordset1['username']; ?></td>
<td><?php echo $row_Recordset1['p_pos']; ?></td>
<td><?php echo $row_Recordset1['passw']; ?></td>
<td><div align="center"><a href="deleat.php?user_id=<?php echo $row_Recordset1['user_id']; ?>"> ลบ
</a></div></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<?php while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<br>
<table border="0" width="33%" align="center">
<tr>
<td width="24%" align="center"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">หน้าแรก</a>
<?php } // Show if not first page ?>
</td>
<td width="24%" align="center"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">ย้อนกลับ</a>
<?php } // Show if not first page ?>
</td>
<td width="24%" align="center"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">หน้าถัดไป</a>
<?php } // Show if not last page ?>
</td>
<td width="28%" align="center"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">หน้าสุดท้าย</a>
<?php } // Show if not last page ?>
</td>
</tr>
</table>
<br>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
</table>
</form>
รบกวนด้วยนะคะ
|
 |
 |
 |
 |
Date :
2009-07-16 13:56:10 |
By :
preapo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วย Print Screen หน้าข้อมูลมาให้ดูเป็นตัวอย่าง
หน่อยนะครับ จะได้ง่ายขึ้นที่บอกว่า เพิ่มขึ้นมานะครับ
|
 |
 |
 |
 |
Date :
2009-07-17 11:02:44 |
By :
taobsd |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สงสัยตรงนี้จัง
$insertSQL = sprintf("INSERT INTO personal (user_id, passw, p_pos, username) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['บุคคลากร'], "int"),
GetSQLValueString($_POST['รหัส'], "text"),
GetSQLValueString($_POST['manu1'], "text"),
GetSQLValueString($_POST['ชื่อ'], "text"));
อธิบายให้ฟังหน่อย
|
 |
 |
 |
 |
Date :
2009-07-17 11:08:07 |
By :
taobsd |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|