hi all
i have news publishing script.
every script has own id (www.example.com/index.php?id=12 (for ex)
who can help me Make comments script
i want that let it possible to add comments each news
when whatever news selected let it comes with its comments
Thanks for attention

Hello,

Sadly, you won't actually get your work done for you. This is really simple though.

I'll give you some steps, this should help:
>> Create a table called 'Comments'

comments.php
<?php
    // connect to the database
  
    $id = $_GET['id']; // get the news id, passed through the URL
    $q = "SELECT * FROM comments WHERE news_id='$id';
    $r = mysql_query($q);
?>

new_comment.php

<?php
    $id = $_GET['id'];
    $q = "INSERT INTO comments (VALUE, VALUE, VALUE) VALUES ('$value', '$value', 
                                                   '$value')"; 
    $r = mysql_query($query);
?>

Hope this helps! There are other ways. Also, using the ID method is very insure, make sure you check it for numeric data.

thank you
this is my script comment php
i tested its post method with

<?php
$no=$_GET["no"];

echo "<form name=\"\" action=\"part.php\" method=\"post\">

Имя:<input name=\"data[0]\" type=\"text\" value=\"\"><br/>

e-mail:<input name=\"data[1]\" type=\"text\" value=\"\"> <br/>
<textarea name=\"data[2]\" rows=5 cols=20 wrap=\"off\"></textarea>
<br/>
<input type=\"submit\" name=\"add\" value=\"добавить\">       <br/>
<input type=\"hidden\" name=\"az\" value=\".$no.\">  
</form>";
	?>

but in response it returns me

Array
(
    [data] => Array
        (
            [0] => sdfsdf
            [1] => sdfs
            [2] => sdffs
        )

    [add] => пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ
    [az] => \\\'116\'
)

but i only need

116

not

\\\'116\'

thanks again for attention

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.