Hey
Underneith is my code, im having a problem where as when i click the delete button it does what i need it to do (delete a thead) however it also delete the 'title' fields from every other entry in my database ??

this is substantually weird
can anyone help ??

thankyou in advanced
:

<a href='delete.php?sent=true' style="margin-left:60px; font-size:14px; color:#FF0000;"><b>Click me to delete</b></a>


<?php
if ($_REQUEST == 'true') {
$query = "DELETE FROM `forumtutorial_posts` WHERE parentid = '$parentid' OR postid = '$parentid'";
if (mysql_query($query)) {
echo "<script>alert('Topic Deleted'); location.href = 'members.php'; </script>";
}
else {
echo "<script>alert('Something Went Wrong, Contact Reece Stanton'); location.href = 'members.php'; </script>";
}
}
?>

pass the auto increment id to the delete command..which is unique in your table...
or post table structure ...
and here what are those parentid and postid...
i think postid is your unique id...???

hey
thanks for the reply

yes its the auto increment id that gets stored and then used as a rope to delete the thread, and all the posts inside.

parent id is all of the posts in a thread. so if my threads postid was 1 all the posts in it would have a parent id of 1.
and the post id is simply the auto increment

i hope you can help
thans in advanced

so,you wan to delete only that post,then simple use:

$query = "DELETE FROM `forumtutorial_posts` WHERE postid = '$parentid'";

i don't know, why you are writing the below line..could you please tel me what is the reason behind that line...

parentid = '$parentid' OR

or if you want to recognize both parentid and postid then use AND instead of OR.

heyy1

i've found the problem

<?php
$parentid = $_REQUEST['delid'];
echo $parentid;
?>
<a href='delete.php?sent=true' style="margin-left:60px; font-size:14px; color:#FF0000;"><b>Click me to delete</b></a>

<?php
if ($_REQUEST['sent'] == 'true') {
$query = "DELETE FROM `forumtutorial_posts` WHERE parentid = '8' OR postid = '8'";
if (mysql_query($query)) {
echo "<script>alert('Topic Deleted'); location.href = 'members.php'; </script>";
}
else {
echo "<script>alert('Something Went Wrong, Contact Reece Stanton'); location.href = 'members.php'; </script>";
}
}   
	?>

i echod the parentid and it holds this:
?id=12

instead of this:
12

im sure this is just a simple problem
any ideas?

thanks

heyy

all its doing is deleing the post that has an postid of '12' and any other posts that parent is post '12' (parentid).

or if you want to recognize both parentid and postid then use AND instead of OR.

I have to use OR because im looking for anything with either a postid or a parent id of '12'.
If i was searching for both, it would only find the parent post, everything inside wouldnt be deleted.

I hope you understand, look at my post above i think thats the problem.

hey
thanks for your help
but its solved

it was a url parse error lol

thanks again

hey
thanks for your help
but its solved

it was a url parse error lol

thanks again

ok.......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.