MySQL and PHP - CIS159/CIT32

Weekly Schedule

To find out when I am on campus, check My Schedule from the bottom of my home page.

Remember the summer is a short semester so about half the weeks you are going to have to do two assignments. I would do it now!

Please note that I have posted the work for unit #7 which is the halfway mark in the course. By the end of the first week in July, you really should try to have completed through unit #7.

Week Information
Assignments due in one week unless otherwise stated. I may add some things during the week, so double check the schedule each week! Please keep copies of all work you submit until you receive your final grade at the end of the semester.
Final When the work is close to complete, you can contact me about the final.
Unit #14 This week we will deal with sessions, cookies and some data manipulation. I will look at data manipulation on Tuesday since the lock down is happening and we will look at cookies and sessions.
Examples you can load onto your area on the server to test 4/30 (functions)
Examples you can load onto your area on the server to test 5/2 (sessions and cookies)
Decoding challenge:
I want you to decode a word and return the decoded result. You need to use explode for this assignment. Take in the code dtgcm and find the location of each in the alphabet (I want you to explode the alphabet into an array). When you find the letter, back up by 2 and retrieve that letter to decipher the code. That means the result will be break because backing up 2 letters from d gets b and backing up two letters from t gets r etc. Now you should include the code that when you start with a backing up 2 gets y and when you start with b, backing up 2 gets z.
Cookie assignment: Write a series of programs to place a cookie, check a cookie, delete a cookie.
Session assignment: Write a series of programs where you take in pay per hour and hours worked and receive it in another program and calculate and show pay. Use sessions to hold and access the data.
Unit #13 Examples you can load onto your area on the server to test 4/25 (email cont)
Make a simple database table with a name and email in it (make two records have my two example emails and one have yours). Then write a php email script to send an email to everyone on the database table. Make the email have a lot of text from html that you send and include a variety of things. I would like you to take in information as I did in an HTML and validate it, then pass it for processing and send the email and then have it use header(location...) to say something. Like the example I went over in class.
Unit #12 This week we will do a little more with functions and look at images as well. Then we will move on to email.
Examples you can load onto your area on the server to test 4/16 (functions, images)
Examples you can load onto your area on the server to test 4/18 (email)
Quiz on databases and images
I want you to send me emails use php - send one that is very basic and one using HTML that tries things like images, color, lists, tables etc. Please remember not to use my address until you are ready to turn in. I will check mainly so that would be the best one to use. Remember, you need to send me an email to the regular email when you have done it and also remember that in testing it will only work with emails.
Unit #11 This week we will continue with arrays and start to look at functions:
Examples you can load onto your area on the server to test 4/9 (functions)
Write the program to guess a number between 1 and 25. This should be written on one php page meaning the input for the guess and the processing are on the same page. Be sure you are using function(s) in this assignment. Note: I want you to tell the user whether it is high, low or correct and let them keep guessing until it is correct.
Unit #10 This week we will continue with arrays.
Examples you can load onto your area on the server to test 4/1 (arrays more)
Examples you can load onto your area on the server to test 4/1 (associative arrays)
Examples you can load onto your area on the server to test 4/4 (more arrays with comments)
This is an assignment that everyone must do: If you have problems with it, send me your best attempt!
Problem 1: I want you to set up arrays to take a course number and get the associated course name and the professor teaching the course. I want you to use associative arrays where the first key would be a specific course number and that would get a course name. In the basic version of this, you would then go to a second array and use the course name to extract the professor. As you can see from the output below, I used CIS120, CIS121, CIS122, CIS155, CIS159.
For extra credit, do this again using a two dimensional array.
My not so pretty solution
Problem 2: Modify the program above to use a foreach to show all of the content of the array/arrays.
Problem 3: Math Array
The statements Multiply by 0, Multiply by 1 are stored in a one dimension array and displayed. You need to extract the message from the array and display it before you show each group. You are going to display the math facts and the answers. The answers need to be stored in a two dimensional array. Set up a two level table to print out the math facts and get the answer from the two dimensional array. The two multipliers are the indexes that allow you to extract the answer. I used a nested while loop to do this and another time I used a nested for loop.
QUIZ: Array Quiz
Unit #9 I am going to suggest for privacy reasons that you change your password file to have a php extension rather than an inc extension.
We are going to looking at maintenance of tables.
Examples you can load onto your area on the server to test 3/26
Examples you can load onto your area on the server to test 3/28 (arrays)
Next we are going to start looking at arrays - we will continue next unit.
Your assignment is to create a table using php script. The table should have 5 fields with an least one numeric field. You then need to populate the table with at least 5 records. Next, I want you to write code to update your database table. I want you to let the user choose whether they want to add, change or delete (this means presenting all choices and acting on their decision). I then you want to take in the needed data and make the add, change or delete happen. When you are doing a change you must figure out a way to decide if you are adding data to the field, deleting data from the field or changing the data from the field. I want you to start with a menu and make the choice and then bring up the approriate form to fill out, send the information to be updated. You should be able to update all but the key field. I want yours to be far better than my individual update programs. The completeness of the processing will impact the grade.
Unit #8 We will continue with PHP getting data from MySQL.
Examples you can load onto your area on the server to test 3/12
SQL in PHP Assignment
Unit #7 The goal is to wrap up MySQL this week and start integrating with PHP.
Examples you can load onto your area on the server to test 3/7
SQL play computer assignment On this assignment I want you to figure out the results, I do not want you to submit to SQL - it truly is a play computer assignment.
Intro MySQL in PHP
Unit #6 We will continue looking at MySQL this week. We will look at the design of a relational database and we will look at examples left over from last week.
Note that I was overly ambitious. We are still looking at notes from week #5.
Payroll database Explanation to use below
Relational Database Assignment
Unit #5 We will continue looking at MySQL this week. Check chapter 9 in the text and a couple of the many online resources as well as my examples.
Keys, indexes etc.
Multiple tables
MySQL assignment: Second SQL assignment
Again, for those who took Oracle, please notice the similarities and differences.
Check back and see how far we got!
Unit #4 Again, please remember that the dates on these examples are from spring 2013. Just follow along and read the ones in the unit that you are working on.
Also, please remember that you need to get through 15 units this summer. I am putting up the units so that you can do multiple per week since there are only about 10 weeks in the summer semester. There is no avoiding the need to double up!
Examples you can load onto your area on the server to test 2/12
This unit we are also going to start looking at MySQL. I want to get the fundamentals of both PHP and MySQL out of the way!
Your book covers this I think in chapter #9, so...
First we are going to look at MySQL through putty and then we will incorporate it into PHP.
You will be accessing MySQL on the cisweb server. Information about MySQL is available at their web site. MySQL site
Information about using it at BCC is on this handout. Using MySQL on the cisweb server
Note: You will need your cisweb username and password. If you have not gotten it yet, contact me. You should also get a copy of PuTTY to use with MySQL if you plan to work from home. PuTTY is available in the labs. Two sites that can be used to download PuTTY are:
Here is an example sheet for use when you are creating databases and tables in putty: Using putty to create a database and table
Putty Notes
Here is another example sheet for use when you are maintaining and doing queries similiar to the ones I have assigned. Using SQL with MySQL
You should be looking up tutorials on SQL. Two that I think are good are:
SQL Tutorial (based on MySQL)
A Gentle Introduction to SQL This is especially helpful for someone who has had Oracle because it shows comparisons between the two versions.
You are allowed to have two databases (each can have multiple tables), under your cisweb. You can see the names of the databases if you login to mysql through putty and give the command show databases;
Beginning MySQL notes
Data types
More SQL
Loop and if assignment
SQL assignment
Note that in the sample, I took an example I had used in Oracle. You need to check out how to do the date in MySQL.
Unit #3 You should read chapter #3 in the PHP/MySQL Programming text book. Please read along in the text book at the rate of about a chapter a unit. I really think of the textbook largely as a reference.
Examples you can load onto your area on the server to test 2/5
Examples you can load onto your area on the server to test 2/7
Please look at "Go West Across America with Lewis and Clark" which is where I got the idea for the Boston Tea Party game. Lewis and Clark adventure
This week we are going to look at decisions and developing a multipage site. Depending on time, we may start loops.
I would like you to write an educational game for kids about some event or series of facts. It should be something along the lines of what I did for the Boston Tea Party. It should have a minimum of 3 pages.
Unit #2 This week we will start PHP. Please look at the beginning PHP examples that I have listed below. There are additional examples from previous classes and PowerPoints available at the web site. You should read chapter #1 and start reading chapter #2 in the text book. Note that you are doing PHP and MySQL on the server so you do not have to attempt to set it up.
I dated the things as I was doing them this Spring, ignore the dates. The ones included here on the week of are the ones we are using. The older examples have some syntax errors caused by changes to the language.
First PHP list with code
Accompany examples you can load onto your area on the server to test 1/29
Examples you can load onto your area on the server to test 1/31
For all assignments, send me the address that I can run in the browser to test your program and also send a copy of the code.
Quiz Quiz
Homework: Memo assignment Make up 5 names and use the 7 days of the week. and notice in my example I have you select a first name but I put out the whole name. You can make up the names. Also note that the select is Wed but in the memo I use Wednesday. Note we will be looking at a similiar example as we go along.
Unit #1 There are 15 weeks during the fall/spring semesters and I will post the same number of units during the summer. That means that you will have to pace yourself to do more than one unit some weeks to get through the material. I would like to give you flexibility, so I will post a few units in the next week so you can work at a pace that matches your schedule. Please note in the text of the information I will end up using unit and week interchangeably. Please note that you will find the Smartboard notes and audio for the lectures given last year and I would suggest you access them. I do the summer course pretty much the same way I did the spring semester.
Read chapter #1 in PHP/MySQL Programming. We will start off the semester with HTML/XHTML. If you have already had CIS122/44 or have previous experience, this will be a review. If you have taken CIS120/17, you have already been introduced to HTML. For others I suggest that you read chapter #1 carefully and use resources at the page for CIS122/44 or other resources on the web to accquaint yourself with HTML.
A great reference for writing HTML is W3Schools
The students in this class have a variety of backgrounds, so for some HTML is review and for others it is relatively new.
Handout on using WinSCP3 Note instead of the host as we are now using
Note that WinSCP3 is available as open source software and you can download it for home use.
When logging in at school, you should not enter your password and you should not save. If you do not enter the password you are prompted for it in a session, but it is not saved. This provides you with some security for your site. You should be getting a username/password for the BCC site at the end of this week.
We will be working exclusively off the BCC site. You do not need to install PHP or MySQL, they are on the server.
We will experiment with logging in to the server and look at some of the examples at the site located in Beginning PHP examples zipped under Site Resources/Code Examples.
You can check HTML examples under my CIS120 and CIS122 sites. This example covers some of the fundamentals: html5example.html
If you are new to HTML, I want you to build a web page and upload it to the server (that cannot be done until you get your username and password). The page should include at least list, tables, CSS and forms.
If you are experienced with HTML, I want you to develop a page that challenges you and uses elements that you stretch your knowledge - this is the time to explore more CSS or forms - experiment! Try out some of the new features in HTML5 and CSS3.


Send e-mail to Priscilla Grocer:

Back to the Top
Return to home page
Return to previous page