Jump to content

problem with SELECT


kleb

Recommended Posts

I've re-done you're reply.php file.

 

You will need to add a new input to your form that posts the reply message something like this:

 <input type="hidden" name="topicsID" value="<?PHP echo intVal($_GET['id']);?>"> 

 

Then change your reply.php file to the following, which will add the "topicsID" to the database so you know which topic the comment was posted for.

 

<?PHP

  include"header.php";

  if($_SERVER['REQUEST_METHOD'] == 'POST') {

    $topicsID = intVal($_POST['topicsID']);
    $comment = mysql_real_escape_string(trim($_POST['comment']));
    $name    = mysql_real_escape_string(trim($_POST['name']));

    if($comment!=='' && $name!=='' && $topicID != 0) {
      $ins="INSERT INTO `post` (`topicsID`,`post_content`,`post_by`)VALUES({$topicsID}, '{$comment}','{$name}')";
      mysql_query($ins) or die(mysql_error());

      if(mysql_affected_rows()) {
        echo"succesfull, you can click back to view your comment and other new comments";
      } else {
        echo"You can not post an empty page or leave your name blank";
    }
  }

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.