0

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

Edited by Ezzaral: Edited URL to generic example.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by azegurb
0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.