我的更新表单遇到问题。表单不会从数据库中检索任何数据。
谁能告诉我哪里出错了。
这是我的更新页面编码。
Install-Package RestSharp

这是更新表单编码
<?php require_once( 'Connections/smpiconnection.php'); ?>
<?php if (!function_exists( "GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue="" , $theNotDefinedValue="" ) { if (PHP_VERSION < 6) { $theValue=g et_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue=f
unction_exists( "mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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; } } mysql_select_db($database_smpiconnection, $smpiconnection); $query_updatedata="SELECT * FROM maklumat_pc" ; $updatedata=m ysql_query($query_updatedata, $smpiconnection) or
die(mysql_error()); $row_updatedata=m ysql_fetch_assoc($updatedata); $totalRows_updatedata=m ysql_num_rows($updatedata); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<td>Agensi</td>
<td>Jabatan</td>
<td>Work_Group</td>
<td>Computer_Name</td>
<td>Kategori_Infra</td>
<td>Nama_Pengguna</td>
<td>Jawatan</td>
<td>Gred_Jawatan</td>
<td>Kumpulan_Perubatan</td>
<td>Tahun_Perolehan</td>
<td>No_Siri_Komputer</td>
<td>No_Aset</td>
<td>Jenis_OS</td>
<td>Jenama_PC</td>
<td>Model_PC</td>
<td>Model_Monitor</td>
<td>Harga_Infra</td>
<td>Cara_Perolehan</td>
<td>Status_Antivirus</td>
<td>Lesen_Antivirus</td>
<td>Jenama_Antivirus</td>
<td>Status_Penyelenggaraan</td>
<td>Syarikat_Penyelenggaraan</td>
<td>Status_Lan_Pc</td>
<td>Ip_address</td>
<td>Status_Infra</td>
<td>Processor</td>
<td>Ram</td>
<td>Hard_Disk</td>
<td> </td>
</tr>
<?php do { ?>
<tr>
<td>
<?php echo $row_updatedata[ 'Agensi']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Jabatan']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Work_Group']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Computer_Name']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Kategori_Infra']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Nama_Pengguna']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Jawatan']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Gred_Jawatan']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Kumpulan_Perubatan']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Tahun_Perolehan']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'No_Siri_Komputer']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'No_Aset']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Jenis_OS']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Jenama_PC']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Model_PC']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Model_Monitor']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Harga_Infra']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Cara_Perolehan']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Status_Antivirus']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Lesen_Antivirus']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Jenama_Antivirus']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Status_Penyelenggaraan']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Syarikat_Penyelenggaraan']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Status_Lan_Pc']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Ip_address']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Status_Infra']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Processor']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Ram']; ?>
</td>
<td>
<?php echo $row_updatedata[ 'Hard_Disk']; ?>
</td>
<td><a href="updateform.php?serial=<?php echo $row_updatedata['No_Siri_Komputer']; ?>">update</a>
</td>
</tr>
<?php } while ($row_updatedata=m ysql_fetch_assoc($updatedata)); ?>
</table>
</body>
</html>
<?php mysql_free_result($updatedata); ?>
&#13;
答案 0 :(得分:0)
除了其他人提到的(这篇文章没有足够的信息,格式也不好)。我最好的猜测:你正在混合$ _GET和$ _POST。
你有一个块
if (isset($_GET['No_Siri_Komputer'])) {
$colname_Recordset1 = $_GET['No_Siri_Komputer'];
}
应该是:
if (isset($_POST['No_Siri_Komputer'])) {
$colname_Recordset1 = $_POST['No_Siri_Komputer'];
}
否则$ colname_Recordset1将始终为-1,我认为这不是你想要的。