誰かが私を助けてくれるのではないかと思います。
以下のコードのセクションを使用して、に関連するレコードを正しくリストするテーブルを作成していますcurrent user
。
/* display row for each user */
echo "<tr>\n";
$theID = $row['locationid'];
echo " <td style='text-align: Center'>{$row['locationname']}</td>\n";
echo " <td style='text-align: Left'>{$row['returnedaddress']}</td>\n";
echo " <td style='text-align: Center'>{$row['totalfinds']}</td>\n";
echo " <form action= locationsaction.php method= 'post'><input type='hidden' name='lid' value=$theID/> <td><input type= 'submit' name= 'type' value= 'Details'/></td>
<td><input type= 'submit' name= 'type' value= 'Images'/></td>
<td><input type= 'submit' name= 'type' value= 'Add Finds'/></td>
<td><input type= 'submit' name= 'type' value= 'View Finds'/></td>
<td><input type= 'submit' name = 'type' value= 'Delete'/></td></form>\n";
各テーブル行の最後には、locatiosnaction.php
以下に示すボタンの選択があり、ユーザーを他のページにナビゲートし、すべてメイン テーブル レコードにリンクします。
「locationsaction.php」
<?php
session_start();
$_SESSION['lid'] = $_POST['lid'];
if (isset($_POST['type'])) {
$urls = array(
'Details' => 'viewlocation.php',
'Add Finds' => 'addfinds.php',
'Images' => 'addimages.php',
'View Finds' => 'locationfinds.php',
'Delete' => 'deletelocation.php'
);
$url = $urls[$_POST['type']];
header("Location: " . $url);
}
?>
私が抱えている問題は、レコードの削除を中心に展開しています。これは私が使用しているクエリです:
「deletelocation.php」
<?php
$lid = $_SESSION['lid'];
$query = "DELETE FROM detectinglocations WHERE locationid='$lid'";
$result = mysql_query($query);
?>
ユーザーが deletelocation.php スクリプトに移動するため、ボタンの機能は正常に動作しますが、レコードは削除されません。
私はいくつかのスクリプトを参照として使用してきましたが、それらに正しく従ったと思っていましたが、明らかにそうではありませんでした。
誰かがこれを見て、どこが間違っているのか教えてください。
多くの感謝と親切な敬意