Jump to content

Blaze

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Blaze

  1. To your first question, you can send variables to the URL using the GET method... look it up, its here on w3schools.
  2. Blaze

    Php comments on news

    oh! Youre simply genious! I finally understood it, thanks a lot man! <3
  3. Blaze

    Php comments on news

    I know that I need the link to show up like that, the thing is, I don't want to do it by opening each page and giving it an id.I was thinking along the lines of when clicked on the "add a comment" part, it would somehow read the comment's id and then have the id as a variable on the typing part, so that i can use that and add it to the comment's mysql table as a news_id or something similar. The thing is i dont know how to do that... This gives me an idea. I'm adding the "Add a comment-view comments" button via php, right after the news are posted. So i assume i can make the link using POST variables? like:$id=$_POST(id);echo '<a href='addcomments.php?[b]id=$id[/b]'>Add a comment</a> - <a href='viewcomments.php?[b]id=$id[/b]>View Comments</a>'; But its the bold part what im not sure of (the id=$id). Wait a second, what did you just did there? Make an invisible input with the value of the old id, what for? I lost myself there.$news_id = intval($_GET['id']);$result = mysql_query("SELECT * FROM comments WHERE news_id={$news_id}"); Lastly, what does that intval mean? interval or is it one of mysql data types?Thanks a lot for your help.
  4. Blaze

    Php comments on news

    Alright, i'll try to explain myself the best i can. I'm spanish, my english isn't great. So please... bear with me. Thanks in advance to anyone that tries to help.I was learning php, and trying to add a "Add a comment" for the news section on my site. I managed to make the add a comment page, and the view comments page. Now, here is the issue.For example, i have two news on the frontpage, both with different id (on the mysql table). But whenever i click the view comments page, it shows the comments for BOTH. That's because I know i should use a WHERE clause on the mysql command for loading the comments, based on news id. My issue here is,I don't know how to make the "add a comment" page have the news id added dinamically so that it can be read later only if the same id is on the comments. Im not sure if i make myself clear...http://www.dfblaze.net/index2.phpGo there, and try to add a comment to the FIRST news post. Then view the comments for the second one, and you'll see the same comments. I hope i made myself clear now. :)Thanks to anyone, again. I've been struggling with this all day.
×
×
  • Create New...