Tips for Assignment 2

I suggest you read the rubric in Canvas (“Assignment 2 – database app”) first of all. Like all rubrics, it lists what you are expected to do.

Then you’ll read through the Assignment 2 document. You already know you need to create a fresh new database. You also have to create several files to perform the tasks described in the Assignment 2 document.

  1. Think about your database. What should its name be? What should the table name be? What are the column names? What are their correct data types (INT, TEXT, etc.)? Remember that you are creating a public-facing database, not one that each person can use privately. Also, don’t reinvent the wheel (example: do not make IMDb).
  2. Think about the way the contents of the database should look when they are all displayed on a web page (example). You probably need to use a table. You might want to design and code the page with dummy text in the table first — and no PHP — so you will know what it’s going to look like.
  3. Think about the form that the user has to fill in. Remember that enter_new_record.php (see it live) in the sockmarket repo does everything you need — but in your form, the names of the input elements will not be the same as the ones in enter_new_record.php. (You are not selling socks!) Also remember that using a group of checkboxes would make a lot of extra work for you, so don’t do that. Radio buttons or a select menu will be okay, because there the user can only choose one thing. If you want to use all input text fields in your form, that’s fine.
  4. Think about the index.html page, where the user learns what the database is and what they can do with it. Open index.html (in the sockmarket folder) in your browser to see what I mean.

That’s the project: a database, an index.html page, a form the user can fill in (which writes to the database), and a page that reads the database and writes it out to a web page. By the way, that last one is what we saw in read_db.php, the first file explained in “MySQL and PHP: Next Steps.” Remember that you need to use the mysqli_ commands to prevent a SQL injection attack on your database. Refer to the document “Using the Sock Market files” as well as pages 5–9 in “MySQL and PHP: Next Steps.”

How to work

I suggest you use XAMPP and get everything working there, on your own laptop, and then at the end transfer it all to your hosted website. (Otherwise you will have to keep uploading files again and again, ugh.) You know you can import the database table(s) from XAMPP to your live site — we did that in class.

The other part of transferring will be like what you did for Assignment 1. Go back and read those steps when you’re ready to copy your database app to your website. Remember you will have to make some changes to the database.php file. Make sure your database on the live website has a username (NOT root) and password!

Everything you need should be in the Assignment 2 document or linked in it. You definitely should borrow heavily from the sockmarket repo, but RESIST the temptation to copy whole files. In particular, you MUST NOT copy the whole sockmarket repo, because it includes a lot of files you will not need for your database! I do not want to see those files in your GitHub repo!

As for GitHub: Yes, you MUST make a new repo. Use the GitHub Desktop app, click the “Add a Repository” button (upper left), and make sure to select ADD, not Create, so you can choose the folder in XAMPP htdocs that contains your project. You can do this at the end, or you can do it when you begin work and make multiple commits as you go along, which is how professional coders do it. You do NOT need a gh-pages branch. When you’re done, remember to commit and Publish or Sync so that I can see your final files.

The Khan Academy SQL review

Here’s a link to the SQL review slides, with UPDATE, DELETE and transactions: Modifying databases with SQL. You do not need to use any of those things in Assignment 2! The other two SQL reviews are linked here.

About the Python stuff listed under Week 5

Look at the Course Schedule page for Week 5. Notice there is NO QUIZ. Hooray! However, you need to get started on the Python things before class. Do the listed work, and we’ll continue and/or discuss in class on Feb. 7. You WILL have the assignment listed there, due Friday, and you WILL be finishing any leftover work from Assignment 2 before Friday.

Note also that NOW is the time to get the scraping book if you don’t have it yet.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s