Project assignment 3. Due Monday, November 20 at 10 pm
Displaying database data
For this project installment you need to display posts and comments
using the data stored in the database. Use your team database (I will
send you information by e-mail) and the
"read only" account to access it. The pages should be connected
to each other by links. Copy the files from project assignment 2 into
a separate directory so that the old files can be graded. Below are
the details of this project assignment:
- You need to write a php file displaying posts, another file
displaying comments, and another one displaying information about a
user (such as name, display name, and a link to the user's website, if
any). You may also have
a file with some sort of "front
page" of the blog, but this is optional. In addition you should have
auxiliary php files with functions and other code used by different
files of the program, such as database information (username,
password, etc.), database queries, etc.. Make sure not to
duplicate code unnecessarily.
- To display posts: the posts should be retrieved
from the database using the SELECT statement. If posts are added to
the database then reloading the page should show the change.
- Set a limit on how many posts you can display on a page. As an
extra credit, add a link "more" at the end of the page that will
display the next group of posts.
- Post titles should be links to the page with the post and its
comments. The text showing the number of comments to a post (for
instance, "5 comments") should link to the comments page as well. The
words
"Comment on it" for now may link to the same page since we don't yet
have forms for adding a comment.
- To display an individual post and comments:Use
the GET method (i.e. extended URLs) to pass the parameter to this page
which is the post
ID. Using the ID, select the post and its comments from the
database.
- Just as with posts, set a limit on how many comments you can
display on a page.
To display user information: Clicking on user name
on any page should bring up the page that displays information about
that user. It's OK if the page doesn't have much information on
it. Use GET method to pass the user ID to the page.
- Add a link from the comments page to the page with all
posts.
Requirements
- Database functions should handle errors in a reasonable way (see
in-class example).
- The database connection must be closed at the end. Make sure that
even if there is an error in accessing the data, the database
connection is still closed.
- Use CSS files to format the pages.
- The pages should generate XHTML-compliant code.
This page is a part of CSci 1101
course web site.