Jump to content

DELETE wont work :(


almightyegg

Recommended Posts

[code=php:0]
<?
$mb = mysql_query("SELECT * FROM replies") or die(mysql_error());
$id = mysql_fetch_array($mb);

$GET = $id['id'];

$view = "SELECT * FROM replies WHERE id = '{$_GET['id']}' LIMIT 1";
$view2 = mysql_query($view);
$reply = mysql_fetch_assoc($view2);
//some other code in here which doesnt have anything to do with this....

if(!$step){
?>
<form name="form1" method="post" action="rdelete.php?step=change">
Are you sure you want to delete reply <? echo $reply[id]; ?>?
<input type="submit" name="Submit" value="Confirm" />
</p>
</form><br>
<?
}elseif($step=="change"){
$deletereply = mysql_query("DELETE FROM replies WHERE id = '{reply['id']}'");
echo "$reply[id] was deleted!";
}
?>
[/code]

it doesnt delete.....have i missed something??
Link to comment
https://forums.phpfreaks.com/topic/26388-delete-wont-work/
Share on other sites

doesnt delete still :(
[code=php:0]
<?
if(!$step){
?>
<form name="form1" method="post" action="rdelete.php?step=change">
Are you sure you want to delete reply <? echo $reply[id]; ?>?
<input type="submit" name="Submit" value="Confirm" />
</p>
</form><br>
<?
}elseif($step=="change"){
$deletereply = mysql_query("DELETE FROM replies WHERE id = '{$reply['id']}'");
echo "The reply was deleted!";
}
?>
[/code]
I must have missed something else too  :-[
Link to comment
https://forums.phpfreaks.com/topic/26388-delete-wont-work/#findComment-121099
Share on other sites

nope still no change  ??? this is very odd...
[code=php:0]
<?
$mb = mysql_query("SELECT * FROM replies") or die(mysql_error());
$id = mysql_fetch_array($mb);

$GET = $id['id'];

$view = "SELECT * FROM replies WHERE id = '{$GET['id']}' LIMIT 1";
$view2 = mysql_query($view);
$reply = mysql_fetch_assoc($view2);

$tags = array('{MEM_ID}', '{MEM_USERNAME}', '{MEM_CLUTCH}');
$vals = array($mem['id'], $mem['username'], $mem[clutch]);
$qlink['quicklinks'] = str_replace($tags, $vals, $qlink['quicklinks']);
echo "$qlink[quicklinks]";

//Some separate code here

if(!$step){
?>
<form name="form1" method="post" action="rdelete.php?step=change">
Are you sure you want to delete reply <? echo $reply[id]; ?>?
<input type="submit" name="Submit" value="Confirm" />
</p>
</form><br>
<?
}elseif($step=="change"){
$deletereply = mysql_query("DELETE FROM replies WHERE id = '{$reply['id']}'");
echo "The reply was deleted!";
}
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/26388-delete-wont-work/#findComment-121114
Share on other sites

thanks...it now recognises the row etc...but doesnt delete it  ???
[code=php:0]
<?
$id = $_GET['id'];

$view = "SELECT * FROM replies WHERE id = '$id' LIMIT 1";
$view2 = mysql_query($view);
$reply = mysql_fetch_assoc($view2);

\\other code..not to do with this

if(!$step){
?>
<form name="form1" method="post" action="rdelete.php?step=change">
Are you sure you want to delete reply <? echo $id; ?>?
<input type="submit" name="Submit" value="Confirm" />
</p>
</form><br>
<?
}elseif($step=="change"){
$deletereply = mysql_query("DELETE FROM replies WHERE id = '$id'");
$delrep = mysql_query($deletereply);

echo "The reply was deleted!";
}
?>
Link to comment
https://forums.phpfreaks.com/topic/26388-delete-wont-work/#findComment-121150
Share on other sites

[code=php:0]
<?
$id = $_GET['id'];

$view = "SELECT * FROM replies WHERE id = '$id' LIMIT 1";
$view2 = mysql_query($view);
$reply = mysql_fetch_assoc($view2);

if(!$step){
?>
<form name="form1" method="post" action="rdelete.php?step=change">
Are you sure you want to delete reply <? echo $id; ?>?
<input type="submit" name="Submit" value="Confirm" />
</p>
</form><br>
<?
}elseif($step=="change"){
$deletereply = mysql_query("DELETE FROM replies WHERE id = '$id'");
$delrep = mysql_query($deletereply);

echo "The reply was deleted!";
}
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/26388-delete-wont-work/#findComment-121176
Share on other sites

Sorry but that code makes little sense. For starters... what do you need the SELECT at the top for? Next, your form asks if your user is sure they want to delete $id, but if they submit the form $id is never passed to the script again for use in your DELETE. where do you define $step? Why are you using an elseif when an else is sufficient?
Link to comment
https://forums.phpfreaks.com/topic/26388-delete-wont-work/#findComment-121184
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.