I am doing a site where people can leave comments on all the pictures I have photographed. Every photo has it’s own page; Id=1 Id=2 etc.
I would like a comment box where my visitors can add and see other comments already posted.
Any tips or example code would be very appreciated.
I assume you have some basic knowledge about MySQL, PHP and using MySQL with PHP. Do you already have a database table defined?
Anyway, for the comments, assuming they can be written anonymously, I would create a table
comment
as such:Create a simple form that will send you to a php page which inserts the entered data into the database.
The
$image_id
should be replaced in your php script by the ID of the image that is being commented on.The database entry in
addcomment.php
should contain something similar to this:Note: those are only bare bone hints that will both look bad and be insecure, but they should help you getting started with this...
If you are going to put one picture per page, rather than coding why not use some blogging software like wordpress?
No need to code , you can register a account on http://disqus.com and add some javascript to your site, that's all. See document on disqus.com for more information.