In our previous articles, we've created a simple website that allows for users to submit comments about an article. In this article we are going to walk through what happens when someone submits a comment in our test website.

Step 1 - Look at the data currently in the database

Before we post any comments to our database, we'll want to look at our comments table to see what is in it. To do this:

  1. Log into your cPanel and click the phpMyAdmin icon
  2. Click your database in the left sidebar, and then click on your table. If you're following our example, we'll first click on "_mysite" and then "comments".
  3. On the right side of the page, you'll see all of the comments submitted. If you refer to our screenshot below, you'll see we currently only have one comment, which is our test comment from a previous article:
    comments-table-in-phpmyadmin-with-one-test-record

Step 2 - Submit a comment on your website

At this point, we will replicate what a user will do, and that is leave a comment. To do this:

  1. Visit your first page, http://phpandmysql.inmotiontesting.com/page1.php?id=1. It is very important that "id=1" is in the URL, otherwise our php code will not know which article the comment belongs to.
  2. Input a comment and click submit (refer to screenshot below):
    inserting-our-first-comment-on-a-page

The comment has been Posted to the server and we now see a confirmation, "Thank you for your Comment!":
after-we-have-submitted-our-first-comment

At this point, we'll want to run the test again, but this time on page2. Click the link on the page to go to page2.php and insert another comment.

Step 3 - Confirm that your data has been written to the database

Now that we've submitted 2 test comments, we should be able to see them in the database. Follow the same steps from "Step 1" above to view the new comments in the database:
looking-at-phpmyadmin-after-2-test-comments

Now that we have comments in our database, we'll show you in our next article how you can access the database and display those comments on each page.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Like this Article?

Comments

Post a comment
n/a Points
2014-06-25 5:21 am

useful

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

News / Announcements

WordPress wp-login.php brute force attack
Updated 2014-07-17 06:43 pm EST
Hits: 201635

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!