Hello fellow members:

I want to nest my forum replies....meaning reply to a reply....so want to create a 2 dimensional array with one number refering to the orig post and the other for each reply on that post

Could somebody please help me out.

Thanks in advance

my forum_replies table looks like this....

CREATE TABLE IF NOT EXISTS `forum_replies` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `message` text NOT NULL,
  `date` varchar(64) NOT NULL,
  `time` int(25) NOT NULL,
  `edit_time` int(25) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=33 ;

So will I need to create a new nested table with reply_id or simply modify my current table

Well fellow members any advices????:$

Would it be better to add reply_id instead of creating a whole new table and by reply_id the messages will be related by a ID.

Now I am still confused if this would solve my nested replies?

To be honest I am still not clear about nested replies? Would somebody please shed some light.....;-)

Also what if its not reply to a reply instead reply to a comment?????

Help;)

What are the tid and uid columns used for? I think I would have a column for ID of the reply, TopicID for the ID of the thread that it was posted to and a column for ParentID for the ID of the reply that it was posted against. This would mean that every post should be stored in this table, and the first post of a topic would have a NULL ParentID. So instead of forum_replies I would name the table forum_posts.

What are the tid and uid columns used for? I think I would have a column for ID of the reply, TopicID for the ID of the thread that it was posted to and a column for ParentID for the ID of the reply that it was posted against. This would mean that every post should be stored in this table, and the first post of a topic would have a NULL ParentID. So instead of forum_replies I would name the table forum_posts.

id is the ID of the post.

, and yes tid is for topic id for the ID of the thread that it was posted to.

uid is the user id of the user who posted the reply.........

Sorry mate, could you explain me this part please:

This would mean that every post should be stored in this table, and the first post of a topic would have a NULL ParentID. So instead of forum_replies I would name the table forum_posts.

Thanks

All I meant by that was that any post, whether it be a reply to an existing post or one that starts a new topic, should be inserted in this table. If it starts a new topic (as opposed to a reply) I would set a ParentID column to null. If it is a reply to a specific post (as opposed to a topic) I would set ParentID to be the ID of the post that was replied to. TopicID would still house the ID of the thread that was replied to, but in this way you can tell which post has been replied to.

I hope this makes sense, but reading back on it I think I have made myself a bit confused. Let me know...

All I meant by that was that any post, whether it be a reply to an existing post or one that starts a new topic, should be inserted in this table. If it starts a new topic (as opposed to a reply) I would set a ParentID column to null. If it is a reply to a specific post (as opposed to a topic) I would set ParentID to be the ID of the post that was replied to. TopicID would still house the ID of the thread that was replied to, but in this way you can tell which post has been replied to.

I hope this makes sense, but reading back on it I think I have made myself a bit confused. Let me know...

Thanks mate for the explaination.......I think I am starting to understand slowly......

Now currently this is how my table stores the data:

forum_replies

id - tid - uid - message - date - time - edit_time
33 10 4 hey 20/03/2009 1237593182 0


forum_topics

id - cid - title - uid - date - time - message
10 9 hello 4 21/03/2009 1237593182 hiya


Now, wouldn't ParentID be the same as ID?

Thanks

So if I replied to the topic, replying to the post with message "hey", ParentID of my post would be 33, yes. But the ID of my post would not be 33, it would be something else. If auto_increment for example, mine would have ID of 34. So after I replied to that post the tables would look like this:

forum_replies
id - tid - uid - message - date - time - edit_time - parent_id
33 10 4 hey 20/03/2009 1237593182 0 NULL
34 10 6 hey yourself 21/03/2009 1237563999 0 33

forum_topics
id - cid - title - uid - date - time - message
10 9 hello 4 21/03/2009 1237593999 hiya

That's how I would do it anyway. There may be a better solution out there...

So if I replied to the topic, replying to the post with message "hey", ParentID of my post would be 33, yes. But the ID of my post would not be 33, it would be something else. If auto_increment for example, mine would have ID of 34. So after I replied to that post the tables would look like this:

forum_replies
id - tid - uid - message - date - time - edit_time - parent_id
33 10 4 hey 20/03/2009 1237593182 0 NULL
34 10 6 hey yourself 21/03/2009 1237563999 0 33

forum_topics
id - cid - title - uid - date - time - message
10 9 hello 4 21/03/2009 1237593999 hiya

That's how I would do it anyway. There may be a better solution out there...

Mate, I am going to follow your technique.....as it makes sense.

Now at the moment I have a reply box at the bottom of each thread. which is basically replying directly to the topic instead to the comment.

I have two ideas.....

1. Remove the reply box from the bottom of the page and have a reply button which when clicked on directs to the page to the reply page with the reply box.

2. Now, to reply to a comment have a reply or quote button after each comments

What do you recon how should I do it.......?

Thanks

(Please see attached.)

How can I adjust my SQL so that when its reply to a reply it will update the parent_id.

Thanks

Mate, I am going to follow your technique.....as it makes sense.

Now at the moment I have a reply box at the bottom of each thread. which is basically replying directly to the topic instead to the comment.

I have two ideas.....

1. Remove the reply box from the bottom of the page and have a reply button which when clicked on directs to the page to the reply page with the reply box.

2. Now, to reply to a comment have a reply or quote button after each comments

What do you recon how should I do it.......?

Thanks

Yep, that's exactly what I would do. Maybe start with the reply button after each post and worry about the quote button when this is all working. Don't forget that you will need to remember the ID of the post that is being replied to (and later quoted).

(Please see attached.)

How can I adjust my SQL so that when its reply to a reply it will update the parent_id.

Thanks

It's just a matter of adjusting your insert statement so that the parent id is inserted. When the reply button is pressed, you will need to remember the ID of the post being replied to. Let's say it is stored in a variable $pid, then your insert statement becomes:

$sql3 = "INSERT INTO forum_replies (tid,uid,message,date,time,pid) VALUES ($tid,$uid,'$message','$date','$time',$pid)";

Thanks for the reply mate.

I think I will be able to deal with the SQL.

Now the issue is I have decided to have a seperate page for the reply instead of having it in the bottom. Here is the code which basically sends the info to my reply.php from topic.php......

echo "<form method=\"post\" action=\"./index.php?act=reply&id=".$row['id']."\">\n";
				    echo "<tr><td colspan=\"2\" align=\"center\"><textarea style=\"width:100%\" name=\"reply\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Add Reply\" stlye=\"width:90%\"></td></tr>\n";
					echo "</table>\n";

and my reply.php

<?php

if(!$_SESSION['uid']){
header("Location: index.php");
}

if(!$_POST['submit']){
	echo "Invalid usage of file";
}else {
	$tid = mss($_GET['id']);
	$msg = mss($_POST['reply']);

	
	if(!$tid){
		echo "You did not supply a topic to add a reply to";
	}else {
		$sql = "SELECT * FROM `forum_topics` WHERE `id`='".$tid."'";
		$res = mysql_query($sql) or die(mysql_error());
		if(mysql_num_rows($res) == 0){
			echo "This topic does not exist";
		}else {
			$row = mysql_fetch_assoc($res);
			echo "<tr><td colspan=\"2\" align=\"center\"><textarea style=\"width:90%\" name=\"reply\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Add Reply\" stlye=\"width:90%\"></td</tr>\n";
		    $sql2 = "SELECT admin FROM `forum_sub_cats` WHERE `id`='".$row['cid']."'";
			$res2 = mysql_query($sql2) or die(mysql_error());
			$row2 = mysql_fetch_assoc($res2);
			echo "</table>\n";
			if($row2['admin'] == 1 && $admin_user_level == 0){
				echo "You do not have sufficient priveleges to add a reply to this topic";
			}else {
			      if(!$msg){
			               echo "You did not supply a reply";
				       }else {
					     if(strlen($msg) < 10 || strlen($msg) > 10000){
						echo "Your reply must be between 10 and 10,000 characters!";
						}else {
							$date = date("d-m-y") ." at ". date("h-i-s");
							$time = time(); 
							$sql3 = "INSERT INTO `forum_replies` (`tid`,`uid`,`message`,`date`,`time`) VALUES('".$tid."','".$_SESSION['uid']."','".$msg."','".$date."','".$time."')";
							$res3 = mysql_query($sql3) or die(mysql_error());
							$sql4 = "UPDATE `forum_topics` SET `time`='".time()."' WHERE `id`='".$tid."'";
							$res4 = mysql_query($sql4) or die(mysql_error);
							
							header("Location: ./index.php?act=topic&id=".$tid); 
							}
   					 }
			      }
	      }	
	}
}
?>

I am a bit confused as how to call a new page instead of having the reply box in the bottom. Please advice

Thanks

Well I was able to get the reply box on a new page....but I get the following error: You did not supply a reply

Here is my modified code for reply.php

<?php

if(!$_SESSION['uid']){
header("Location: index.php");
}

//if(!$_POST['submit']){
//	echo "Invalid usage of file";
//}else {
	$tid = mss($_GET['id']);
	$msg = mss($_POST['reply']);

	
	if(!$tid){
		echo "You did not supply a topic to add a reply to";
	}else {
		$sql = "SELECT * FROM `forum_topics` WHERE `id`='".$tid."'";
		$res = mysql_query($sql) or die(mysql_error());
		if(mysql_num_rows($res) == 0){
			echo "This topic does not exist";
		}else {
			$row = mysql_fetch_assoc($res);
			$sql2 = "SELECT admin FROM `forum_sub_cats` WHERE `id`='".$row['cid']."'";
			$res2 = mysql_query($sql2) or die(mysql_error());
			$row2 = mysql_fetch_assoc($res2);
			echo "<form method=\"post\" action=\"./index.php?act=reply&id=".$row['id']."\">\n";
			echo "<table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">\n";			    
			echo "<tr><td colspan=\"2\" align=\"center\"><textarea style=\"width:90%;height:200px\" name=\"reply\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Add Reply\" stlye=\"width:90%\"></td></tr>\n";
			echo "</table>\n";
			if($row2['admin'] == 1 && $admin_user_level == 0){
				echo "You do not have sufficient priveleges to add a reply to this topic";
			}else {
			      if(!$msg){
			               echo "You did not supply a reply";
				       }else {
					     if(strlen($msg) < 10 || strlen($msg) > 10000){
						echo "Your reply must be between 10 and 10,000 characters!";
						}else {
							$date = date("d-m-y") ." at ". date("h-i-s");
							$time = time(); 
							$sql3 = "INSERT INTO `forum_replies` (`tid`,`uid`,`message`,`date`,`time`) VALUES('".$tid."','".$_SESSION['uid']."','".$msg."','".$date."','".$time."')";
							$res3 = mysql_query($sql3) or die(mysql_error());
							$sql4 = "UPDATE `forum_topics` SET `time`='".time()."' WHERE `id`='".$tid."'";
							$res4 = mysql_query($sql4) or die(mysql_error);
							
							header("Location: ./index.php?act=topic&id=".$tid); 
							}
   					 }
			      }
	      }	
	}

?>

Please advice

Not sure about this one mate.

Possibly, the html code doesn't have a closing </form> tag. Also, I notice that you use \n for a new line in your html, you should use <br> tags instead for cross platform and browser compatability.

Otherwise, I am not too sure. Try printing out your $_POST array and checking that there is an entry for 'reply'. Use the print_r function to do that, like so:

echo "<pre>";
print_r($_POST);
echo "</pre><br>";

The thing is it is echoing this part of the code:

if(!$msg){
echo "You did not supply a reply";
}else {

It should only do this when the user clicks on the 'reply' button without inputing any message!

This how I call the page from my topic.php page.....

echo "<tr><td colspan=\"2\" align=\"left\"><a href=\"./index.php?act=reply&id=".$row['id']."\">Reply</a></td></tr>\n";					
echo "</table>\n";

Right think the problem is resolved.....hopefully:

I modified my code to this:

}else {
			$row = mysql_fetch_assoc($res);
			$sql2 = "SELECT admin FROM `forum_sub_cats` WHERE `id`='".$row['cid']."'";
			$res2 = mysql_query($sql2) or die(mysql_error());
			$row2 = mysql_fetch_assoc($res2);
			if(!$_POST['submit']){
			echo "<form method=\"post\" action=\"./index.php?act=reply&id=".$row['id']."\">\n";
			echo "<table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">\n";			    
			echo "<tr><td colspan=\"2\" align=\"center\"><textarea style=\"width:90%;height:200px\" name=\"reply\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Add Reply\" stlye=\"width:90%\"></td></tr>\n";
			echo "</table>\n";
		}else{

The if(!$_POST) worked.....:) let me know if it is correct

If it's working as you would like, then it is correct :P

Try testing a few situations to make sure though. What happens if you post a no-message response now? Try it in different browsers if possible, especially IE and FF.

I still have concerns about your html, you don't close the form tag and your newlines might behave strangely. But if it's working then cool! :)

If it's working as you would like, then it is correct :P

Try testing a few situations to make sure though. What happens if you post a no-message response now? Try it in different browsers if possible, especially IE and FF.

I still have concerns about your html, you don't close the form tag and your newlines might behave strangely. But if it's working then cool! :)

Thanks for the advice.......I will change the html once i get reply to reply sorted.....as at the moment it is behaving strangely.

Now see for the SQL, take it I will have to set the parent_id to the id of the reply? what way should I put the SQl......

Because I know I will have to do a insert......first

Right mate I still confused about the SQL:

Here is a test file i made...when keep the mouse on the reply-reply link I can see the id of the comment which is correct but I am not able to go any further....

<?php

error_reporting(E_ALL ^ E_NOTICE); //Report all error except NOTICES

if(!$_SESSION['uid']){
header("Location: index.php");
}

$actz = $_GET['act2'];
$actzz = array('reply','topic','admin');

	
	if($actz == 'reply'){
		$tid = mss($_GET['id']);
		$id = mss($_GET['id']);
		if($id){
			$sql = "SELECT * FROM `forum_replies` WHERE `id`='".$id."'";
			$res = mysql_query($sql) or die(mysql_error());
			if(mysql_num_rows($res) == 0){
				echo "This topic doesn't exist, so therefore you cannot edit it!";
				}else {
					$row = mysql_fetch_assoc($res);
					$user_id = $row['uid'];
					$row = mysql_fetch_assoc($res);
					$sql2 = "SELECT admin FROM `forum_sub_cats` WHERE `id`='".$row['cid']."'";
					$res2 = mysql_query($sql2) or die(mysql_error());
					$row2 = mysql_fetch_assoc($res2);
							
					  if(!$_POST['submit']){
							echo "<form method=\"post\" action=\"./index.php?act=test&act2=reply&id=".$id."\">\n";
							echo "<table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">\n";
							echo "<tr><td class=\"forum_header\" align=\"center\"><textarea style=\"width:90%;height:200px\" name=\"reply\">".$row['message']."</textarea></td></tr>\n";
							echo "<tr><td class=\"forum_header\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Edit This Reply\"></td></tr>\n";
							echo "</table></form>\n";
							}else {
								$reply = mss($_POST['reply']);
									if($reply){
										$r = range(10,10000);
										if(in_array(strlen($reply),$r)){
											$sql3 = "INSERT INTO `forum_replies` (`tid`,`uid`,`message`,`date`,`time`,`reply_id`) VALUES('".$tid."','".$_SESSION['uid']."','".$msg."','".$date."','".$time."','".$reply_id."')";
											$res3 = mysql_query($sql3) or die(mysql_error());
											$sql4 = "UPDATE `forum_topics` SET `time`='".time()."' WHERE `id`='".$tid."'";
											$res4 = mysql_query($sql4) or die(mysql_error);
											
											header("Location: index.php?act=topic&id=".$row['tid']."");
											}else {
												echo "Your message must be between 10 and 10000";
											}
										}
									}
								}
							}
						}
										
	
?>

Thanks

Have you made the necessary change to the forum_replies table? That is, have you added a column to store the parent_id? If so, take a look at my earlier reply (#10) which gives you the SQL you need to insert a new record into the database if it is a reply to a reply. The parent_id of the new record is the id of the comment being replied to, which you are saying you can see...

Have you made the necessary change to the forum_replies table? That is, have you added a column to store the parent_id? If so, take a look at my earlier reply (#10) which gives you the SQL you need to insert a new record into the database if it is a reply to a reply. The parent_id of the new record is the id of the comment being replied to, which you are saying you can see...

yes mate I made the necessary changes to the table and added the field......

But the I am still getting errors as below:

This Topic does not exist
You did not supply a topic to add a reply to

For some reason it is not able to find the topic id or tid.

I have created a test.php for my reply-reply for the time being.

<?php

if(!$_SESSION['uid']){
header("Location: index.php");
}

//if(!$_POST['submit']){
//	echo "Invalid usage of file";
//}else {
	$tid = mss($_GET['id']);
	$msg = mss($_POST['reply']);

	
	if(!$tid){
		echo "You did not supply a topic to add a reply to";
	}else {
		$sql = "SELECT * FROM `forum_topics` WHERE `id`='".$tid."'";
		$res = mysql_query($sql) or die(mysql_error());
		if(mysql_num_rows($res) == 0){
			echo "This topic does not exist";
		}else {
			$row = mysql_fetch_assoc($res);
			$sql2 = "SELECT admin FROM `forum_sub_cats` WHERE `id`='".$row['cid']."'";
			$res2 = mysql_query($sql2) or die(mysql_error());
			$row2 = mysql_fetch_assoc($res2);
			if(!$_POST['submit'])
			echo "<form method=\"post\" action=\"./index.php?act=reply&id=".$row['id']."\">\n";
			echo "<table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">\n";			    
			echo "<tr><td colspan=\"2\" align=\"center\"><textarea style=\"width:90%;height:200px\" name=\"reply\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Add Reply\" stlye=\"width:90%\"></td></tr>\n";
			echo "</table>\n";
			else{
			if($row2['admin'] == 1 && $admin_user_level == 0){
				echo "You do not have sufficient priveleges to add a reply to this topic";
			}else {
			      if(!$msg){
			               echo "You did not supply a reply";
				       }else {
					     if(strlen($msg) < 10 || strlen($msg) > 10000){
						echo "Your reply must be between 10 and 10,000 characters!";
						}else {
							$date = date("d-m-y") ." at ". date("h-i-s");
							$time = time(); 
							$sql3 = "INSERT INTO `forum_replies` (`tid`,`uid`,`message`,`date`,`time`,`parent_id`) VALUES('".$tid."','".$_SESSION['uid']."','".$msg."','".$date."','".$time."','"$reply_id"','"$parent_id"')";
							$res3 = mysql_query($sql3) or die(mysql_error());
							
							header("Location: ./index.php?act=topic&id=".$tid); 
							}
   					 }
			      }
	      }	
	}
}

?>

You need to remember the topic id of the post being replied to as well as its ID. The new reply will have a new ID, the same topic id as the post it replied to and a parent id equal to the ID of the post being replied to.

I am still not clear man as how I will write it in SQL.

I made few more changes to my code as below. I am selecting the topic id from forum replies but after I input data into the textbox and click add reply then send me an error "query was empty"............

Please check my code and advice me on changes to the codes.......

<?php

if(!$_SESSION['uid']){
header("Location: index.php");
}

//if(!$_POST['submit']){
//	echo "Invalid usage of file";
//}else {
	
	$msg = mss($_POST['reply']);
	$tid = mss($_GET['id']);
	
	
	if($tid){
		$tid = mss($_GET['id']);
		$sql = "SELECT * FROM `forum_replies` WHERE `id`='".$tid."'";
		$res = mysql_query($sql) or die(mysql_error());
		if(mysql_num_rows($res) == 0){
			echo "This topic does not exist!";
		}else {
			$row = mysql_fetch_assoc($res);
			//$sql2 = "SELECT admin FROM `forum_sub_cats` WHERE `id`='".$row['cid']."'";
			//$res2 = mysql_query($sql2) or die(mysql_error());
			//$row2 = mysql_fetch_assoc($res2);
			if(!$_POST['submit']){
			echo "<form method=\"post\" action=\"./index.php?act=test&id=".$row['id']."\">\n";
			echo "<table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">\n";			    
			echo "<tr><td colspan=\"2\" align=\"center\"><textarea style=\"width:90%;height:200px\" name=\"reply\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Add Reply\" stlye=\"width:90%\"></td></tr>\n";
			echo "</table>\n";
		}else{
			if($row2['admin'] == 1 && $admin_user_level == 0){
				echo "You do not have sufficient priveleges to add a reply to this topic";
			}else {
			      if(!$msg){
			               echo "You did not supply a reply";
				       }else {
					     if(strlen($msg) < 10 || strlen($msg) > 10000){
						echo "Your reply must be between 10 and 10,000 characters!";
						}else {
							$date = date("d-m-y") ." at ". date("h-i-s");
							$time = time();
							$sq13 = "SELECT `id` FROM `forum_replies` WHERE `id`='".$id."'";
							$res3 = mysql_query($sql3) or die(mysql_error()); 
							$sql4 = "INSERT INTO `forum_replies` (`tid`,`uid`,`message`,`date`,`time``reply_id`) VALUES('".$tid."','".$_SESSION['uid']."','".$msg."','".$date."','".$time."','".$reply_id."')";
							$res4 = mysql_query($sql3) or die(mysql_error());
							
							header("Location: ./index.php?act=topic&id=".$tid); 
							}
													
						}		
					 }
				  }
			   }	
		    }
			
?>
$sql4 = "INSERT INTO forum_replies (tid,uid,message,date,time,reply_id,pid) VALUES($tid,$_SESSION['uid'],'".$msg."','".$date."','".$time."',$reply_id,$pid)";

You need to work out how to find $pid in your php code...

$sql4 = "INSERT INTO forum_replies (tid,uid,message,date,time,reply_id,pid) VALUES($tid,$_SESSION['uid'],'".$msg."','".$date."','".$time."',$reply_id,$pid)";

You need to work out how to find $pid in your php code...

Mate thanks for your reply and also for the help.

I named it reply_id instead of pid so I dont think we need the extra field.

what do you recon would cause the error query is empty

Also how could I find the $reply_id or $pid in my php code??

Thanks

Sorry I haven't seen a query is empty error before - maybe start a new thread to ask someone else?

The $reply_id is just the ID of the message being replied to. I thought you said before that you were able to retrieve this when the reply button was pressed?

Sorry I haven't seen a query is empty error before - maybe start a new thread to ask someone else?

The $reply_id is just the ID of the message being replied to. I thought you said before that you were able to retrieve this when the reply button was pressed?

Nope, I kept $reply_id to store the ID of the comment after a reply is made and yes the ID is visible on the address bar.........

Everything seems to be working alright but I think the issue is here:

}else {
                     $date = date("d-m-y") ." at ". date("h-i-s");
                     $time = time();
                     
                     $sql4 = "INSERT INTO `forum_replies` (`tid`,`uid`,`message`,`date`,`time`) VALUES('".$tid."','".$_SESSION['uid']."','".$msg."','".$date."','".$time."')";
                     $res4 = mysql_query($sql3) or die(mysql_error());
                     $sql5 = "UPDATE `forum_replies` SET `reply_id` = '".$id."' WHERE `message` = '".$msg."'";
                     header("Location: ./index.php?act=topic&id=".$tid); 
                     }

Okay the query is empty seems to be solved.....

Now another error is This topic does not exists! which suggests that its not able to fetch the 'tid' like shown in the code

$tid = mss($_GET['id']);
		 
		$sql = "SELECT * FROM `forum_replies` WHERE `id`='".$tid."'";
		$res = mysql_query($sql) or die(mysql_error());
		if(mysql_num_rows($res) == 0){
			echo "This topic does not exist!";
		}else {
			$row = mysql_fetch_assoc($res);

suggesting that there is no data ?????

What does the mss function do? I think that it is returning nothing whereas it should return the id of the topic...

What does the mss function do? I think that it is returning nothing whereas it should return the id of the topic...

mss function should get the 'ID' of the topic from forum_topics!!!!

mss function should get the 'ID' of the topic from forum_topics!!!!

I don't think it is returning the right value here. Try echoing $tid just before you run your sql, or better yet, echo the sql to the screen and check that it has the right variables.

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.