Deletion question
Posted: Tue Feb 02, 2010 1:39 pm
I have a script running to make a deletion link and it works but when you click it, it deletes the record but it also keeps the link until you refresh the page.
So like lets say it was like
Bob | *link*Delete?*link*
You click the delete link, the record is no longer in the database but the line above still shows until you refresh the page. Is there anyway to stop this from happening? Also here is my code if it helps ignore all the if statements I know switch/case would have been better I'm just too lazy to go change them right now.
So like lets say it was like
Bob | *link*Delete?*link*
You click the delete link, the record is no longer in the database but the line above still shows until you refresh the page. Is there anyway to stop this from happening? Also here is my code if it helps ignore all the if statements I know switch/case would have been better I'm just too lazy to go change them right now.
Code: Select all
$sql = "SELECT * FROM drivers ORDER BY Name";
$result = mysql_query($sql);
$id = $_GET[ID];
$delete = mysql_query("DELETE FROM drivers WHERE ID = $id");
while($list = mysql_fetch_assoc($result)){
echo $list['Name'];
if($list['Link'] != null){
echo ' | <a href="http://trukz.com/driver_display.asp?ID=' . $list['Link'] . '" target="_blank">Link to Driver Page</a> | ';
}
else if($list['Link'] == null){
echo ' | No Link | ';
}
if(!$_COOKIE['InfoSec'] == 1){
if($list['Company'] == "NA"){
echo 'Haulin Glass Expediting<br /><br />';
}
if($list['Company'] == "EU"){
echo 'Haulin Glass Europe<br /><br />';
}
if($list['Company'] == "AU"){
echo 'Haulin Glass Australia<br /><br />';
}
}
if($_COOKIE['InfoSec'] == 1){
if($list['Company'] == "NA"){
echo 'Haulin Glass Expediting | <a href="drivers.php?ID=' . $list['ID'] . '">Delete?</a><br /><br />';
}
if($list['Company'] == "EU"){
echo 'Haulin Glass Europe | <a href="drivers.php?ID=' . $list['ID'] . '">Delete?</a><br /><br />';
}
if($list['Company'] == "AU"){
echo 'Haulin Glass Australia | <a href="drivers.php?ID=' . $list['ID'] . '">Delete?</a><br /><br />';
}
}
}