[請益] 刪除資料不成功
環境是IIS + SQL SEVER
顯示刪除資料主頁面的內碼是:
<?php
//include_once("connectparameterRentHouse.php");
include_once "connectparameterRentHouse.php";
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$tsql="SELECT [t_id], [t_conPerNam], [t_conPerPho]
FROM [tenancyData]";
$params = array( 5, 10);
$result = sqlsrv_query($conn, $tsql, $params);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="" rel="nofollow">http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<title>刪除頁面</title>
</head>
<body>
<center>
<h1><p>刪除頁面</p></h1>
<form name="form1" method="POST" action="deleting.php">
<table width="100%" border="1">
<tr>
<td width="5%"><div align="center"></div></td>
<td width="20%"><div align="center">編號</div></td>
<td width="30%"><div align="center">房屋名稱</div></td>
<td width="30%"><div align="center">電話</div></td>
</tr>
<?php
$i=0;
while ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC))
{?>
<tr>
<td><div align="center">
<label>
<input type="checkbox" name="CB<?php echo $i?>" value="1">
</label>
</div></td>
<td><div align="center"><?php echo $row["t_id"];?></div></td>
<td><div align="center"><?php echo $row["t_conPerNam"];?></div></td>
<td><div align="center"><?php echo $row["t_conPerPho"];?></div></td>
</tr>
<?php
$i++;
}
?>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="送出" >
</div> <div align="center"></div></td>
<td colspan="2"><div align="center">
</div> <div align="center"></div></td>
</tr>
</table>
</form>
</center>
<?php
//var_dump($result);
sqlsrv_close($conn);
?>
</body>
</html>
而負責刪除的內碼:
<?php
include_once "connectparameterRentHouse.php";
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$tsql="SELECT [t_id] FROM [tenancyData]";
$params = array( 5, 10);
$result = sqlsrv_query($conn, $tsql, $params);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="" rel="nofollow">http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<title>刪除中</title>
</head>
<body>
<?php
$count= count($result);
for($i=0; $i<=$count; $i++)
{
echo $_POST['CB0'];
}
sqlsrv_close($conn);
?>
</body>
</html>
感謝大大看完攏長的內碼,
我遇到的問題是一直無法成功刪除資料,
試了很久都一直失敗,
拜託各位幫助我一下。
如果要改很多的話,可以寄個信箱
謝了
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.161.214.195
→
09/06 22:47, , 1F
09/06 22:47, 1F
→
09/06 22:47, , 2F
09/06 22:47, 2F
→
09/06 23:28, , 3F
09/06 23:28, 3F
推
09/06 23:31, , 4F
09/06 23:31, 4F
推
09/07 02:22, , 5F
09/07 02:22, 5F
→
09/07 05:53, , 6F
09/07 05:53, 6F
→
09/07 10:40, , 7F
09/07 10:40, 7F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章