hello there. i have a page where people can upload their picture and link them to other people etc, now i want people to be able to comment on each picture, like a blogg where you comment on each entry. if you press the picture that has been uploaded it opens in a new window wit the filename "show.php" with the script below, <img src="img/<?=$_GET['id']?>.jpeg"> Code (markup): now i wonder how could i make it so that people can comment on these pictures? a form where you add your name and what you want to say, and once submited, it's shown under the picture in question, and that each comment is saved in the table "comments" if possible, and that the users ip addres get's logged aswell. i hope someone can help me with this?
You make a new table called comments. Get a field for: id picid name comment When a person submits it uploads the picid, name they input, and comment the gave. I doubt anyone will code this for you for free.
if the pictures already get a uniqe id in my database in the table "img" ? thething i dont understand is how to make the comments show for let's say image ID (38) and not show 38's comments on picture 39
to bring this up again, i found a comment script that would work, but it want my pages in id insteed. bellow is how i currenlt have it to show my images. <? $MYSQL_HOST = 'test'; $MYSQL_USER = 'test'; $MYSQL_PASSWORD = 'test'; $MYSQL_DATABASE = 'test'; mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD); mysql_select_db($MYSQL_DATABASE); $res = mysql_query('SELECT *,unix_timestamp(tstamp) as utstamp FROM img ORDER BY tstamp DESC LIMIT 6'); echo "<table cellspacing=\"3\" cellpadding=\"1\" border=\"2\"><tr>"; while ($row = mysql_fetch_assoc($res)) { echo "<td>"; $row['message'] = substr($row['message'],strpos($row['message'],' ')); if ( file_exists('img/' . $row['id'] . '.jpeg') ) { $row['picture'] = 'img/' . $row['id'] . '.jpeg'; } else $row['picture'] = ''; if ( $row['picture'] != '' ) { echo '<a href="show.php?id=' . $row['id'] . '">'; echo '<img width="125" src="' . $row['picture'] . '"></a>'; } echo "</td>"; } echo "</tr></table>"; ?> Code (markup): "show.php" shows the picture clicked in a new window with the ID name of the picture in the database, the comment script however as shown bellow <?php $page_id = "6"; // for example include("comments/comments_show.php"); include("comments/comments_form.php"); ?> Code (markup): i need to manually change the number for each page to make a diffrent comment form / comments appear, so i wonder, is it possible to maybe make the code for the comment check the ID of the picture and if the id of the picture in show.php is for example 36 it makes the page ID 36 and shows the correct comment form? or in some way make it automated?