November 27, 201114 yr Hi guys! I need to code a comments section for the games on my website. I know how to do this, however, I'm not sure how to make comments specific to the PHP generated id page. Here is a link so you can get the full picture... The Site In terms of the Database... Table Name: comments Columns: comment_id, comment Any advice would be great! Matt
November 27, 201114 yr Hi guys! I need to code a comments section for the games on my website. I know how to do this, however, I'm not sure how to make comments specific to the PHP generated id page. Here is a link so you can get the full picture... The Site In terms of the Database... Table Name: comments Columns: comment_id, comment Any advice would be great! Matt simple create a field in your comments table that says pid for page id, then every time u write a comment on a certain page insert the page id u have at the top in your url which i assume is id=2, then you can display comments like this specific to each page $id = (isset($_GET['id'])) ? mysql_real_escape_string($_GET['id']); $comment_select = mysql_query("SELECT * FROM `comments` WHERE `pid` = '$id'")
November 27, 201114 yr Author Thanks for the reply! Worked well! I'm new to PHP, so learning all the time! Matt
November 27, 201114 yr Thanks for the reply! Worked well! I'm new to PHP, so learning all the time! Matt Np btw this line $id = (isset($_GET['id'])) ? mysql_real_escape_string($_GET['id']); should be $id = (isset($_GET['id'])) ? mysql_real_escape_string($_GET['id']) : false; was rushing when i wrote it haha
November 27, 201114 yr Thanks for the reply! Worked well! I'm new to PHP, so learning all the time! Matt btw personally i'd wrap each comment in a border and make the color black maybe and not bold, its hard to tell there comments
November 27, 201114 yr Author Okay, thanks for the advice guys! It's for a project I'm doing; pretty much finished now! Matt
Create an account or sign in to comment