how can i insert comment with article by php using id
<p>I am Beginner. I need help, please.
I am having a small problem in the script
I am have in this script ( admin folder) Add contain articles (This page is working to add threads only)
My problem in the Page (read_mor.php)
i make a query with the database to bring news
this is query .</p>

<pre><code>&lt;?php 
include ('config/connect_to_mysql.php');
$id = $_GET["id"];
$fetch = mysql_query("SELECT * FROM posts WHERE id= '$id' ") or die(mysql_error());
while($myrow = mysql_fetch_assoc($fetch)) {
?&gt;
&lt;?php echo $myrow['title']; ?&gt;
&lt;?php echo $myrow['created_on']; ?&gt;
&lt;?php echo $myrow['categories']; ?&gt;
&lt;?php echo $myrow['description']; ?&gt;
&lt;?php echo $myrow['categories']; ?&gt;
&lt;?php } ?&gt;
</code></pre>

<p>everything is v god     </p>

<p>*<em>but when i insert comment in table (comments) 
all comments in table show with any post ..!! *</em> </p>

<p><strong>i need to insert comment with article by id article</strong> </p>

<p>this page for insert comment</p>

<pre><code>&lt;?php
include ('config/connect_to_mysql.php');

$query="INSERT INTO comments (com_id,name,url,email,comment,postid)
      VALUES
      ('', '$_POST[name]' , '$_POST[url]', '$_POST[email]', '$_POST[comment]', LAST_INSERT_ID(postid))" or die(mysql_error());

if ($query)

$result = mysql_query($query);

{
echo "&lt;strong&gt;Thanks!&lt;/strong&gt;&lt;p&gt;Your message was successfully sent.&lt;/p&gt;";  
}
?&gt;
</code></pre>

<p>Table in database 
---- ></p>

<pre><code>comments



 structure for table `comments`
 (
  `com_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `comment` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `yes` int(11) NOT NULL,
  `postid` int(11) NOT NULL,
  PRIMARY KEY (`com_id`)
) ENGINE=MyISAM  DEFAULT  
&lt;/i&gt;
</code></pre>

<p>table of posts
------></p>

<pre><code>CREATE TABLE IF NOT EXISTS `posts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(200) NOT NULL,
  `description` longtext NOT NULL,
  `categories` varchar(200) NOT NULL,
  `post_meta` varchar(200) NOT NULL,
  `post_robots` varchar(200) NOT NULL,
  `meta_title` varchar(200) NOT NULL,
  `meta_description` text NOT NULL,
  `created_by` varchar(100) NOT NULL,
  `created_on` datetime NOT NULL,
  `imageref` varchar(300) NOT NULL,
  `post_status` varchar(70) NOT NULL DEFAULT 'published',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=102 ;
</code></pre>
