[請益] 刪除資料不成功

看板PHP作者 (嗶嗶)時間16年前 (2009/09/06 22:32), 編輯推噓2(205)
留言7則, 5人參與, 最新討論串1/1
環境是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
如果太多的話 可以加我MSN教學 拜託了
09/06 22:47, 1F

09/06 22:47, , 2F
springezez@hotmail.com 謝謝各位 真的麻煩你們了..
09/06 22:47, 2F

09/06 23:28, , 3F
刪除部分的SQL怎麼還是下select?
09/06 23:28, 3F

09/06 23:31, , 4F
完全沒看到 delete 的語法
09/06 23:31, 4F

09/07 02:22, , 5F
真的沒有delete關鍵字耶!@ @ 完全沒有這個動作
09/07 02:22, 5F

09/07 05:53, , 6F
先去了解delete怎麼用比較重要
09/07 05:53, 6F

09/07 10:40, , 7F
抱歉 我在是一次!! 謝謝
09/07 10:40, 7F
文章代碼(AID): #1AeyVnLL (PHP)
文章代碼(AID): #1AeyVnLL (PHP)