私は、SQLからの削除用とデータベースへの追加用の2つのスクリプトを使用しています。1つのスクリプトからヘッダーを使用すると、ヘッダーを使用して別のデータからデータを更新しますか?
私が抱えている問題は、追加スクリプトを実行すると、ページがすぐに変更を示すように更新されるということです。しかし、削除スクリプトを実行すると、即座にこれをリフレッシュせず、出力をキャッシュするように見えますか?
リダイレクト先の出力をキャッシュすると、1つのスクリプトで追加が表示され、もう1つでは削除が表示されないのはなぜですか?
スクリプト
// Set a URL for the user to be redirected to
$header_URL = "Location: ".WEBURL.DOCROOT."pages/parents-evening/{$_SESSION['status']}/";
// SQL statement using the variables from the user to insert into a specific table
$sql = "INSERT INTO $table ($columns) VALUES ($values);";
// Check that the query was successful
if(mysqli_query($conn, $sql))
{
// Success
// Closes the database connection
mysqli_close($conn);
// Sets the redirect location
header($header_URL);
// Exits the script
exit();
}
else
{
// Fail
// Closes the database connection
mysqli_close($conn);
// Sets the redirect location
header($header_URL);
// Exits the script
exit();
}
スクリプト
// Set a URL for the user to be redirected to
$header_URL = "Location: ".WEBURL.DOCROOT."pages/parents-evening/{$_SESSION['status']}/";
// SQL statement to delete from the table provided where the ID is equal to either the POST or GET value
$sql = "DELETE FROM {$table} WHERE id = {$_POST['delete_id']}{$_GET['delete_id']}";
// Check the query was successful
if(mysqli_query($conn, $sql))
{
// Success
// Closes the database connection
mysqli_close($conn);
// Sets the redirect location
header($header_URL);
// Exits the script
exit();
}
else
{
// Fail
// Closes the database connection
mysqli_close($conn);
// Sets the redirect location
header($header_URL);
// Exits the script
exit();
}
については
POST
ことは_what_ないのですか?あなたはそれが最終的にリフレッシュすると言うことに行きます、それで何がやっていませんか? –
@PatrickQ私は私の質問に言い返しました。しかし、1つのスクリプトが実行されたときに即座に更新され、他のスクリプトは即座に実行されません。 –
'{$ _POST ['delete_id']} {$ _ GET ['delete_id']}'という特別な理由はありますか?私はそれらのうちの1つしか期待しません。そして、本当にあなたは本当にパラメタの束縛を調べるべきです。 –