MySQL and PHP - CIT32

Weekly Schedule

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.
Week #15
Week of December 14th
Your final exam has been emailed to you. It is due one week from the date mailed (that makes it due next Saturday, December 19th). Contact me if you have any questions or if you did not receive the final.
Week #14
Week of December 7th
Work on your project! Final will be posted at the end of the week.
Week #13
Week of November 30th
We will start the week doing cookies.
Cookie Notes
I want you to look at information about sessions:
Session Notes - start
Session Notes
I need you to experiment with cookies and sessions and show me the results by taking pictures of the screens and sending them to me along with the actual code you wrote.
Final Project: For your final project, I want you to pick something you would like to experiment with and learn more about. You need to send me a proposal.
Here is an alternative you can do: You want to have the quiz check the user and make sure they have a valid username and password to take the quiz, you want to have a timing on the quiz, you want to record that they have taken the quiz so they cannot go back a second time, and then for an A you want to take questions from a database and randomly choose 10 to ask. You need to check and grade the quiz. Note that I want you to use a database not a file.
Week #12
Week of November 23rd
We will start this week looking at PHP functions.
Function examples
A good source for information on managing images with a Web Database Application: images and database
I experimented and this is a zip of what I created - it is basically the code from the onlamp site: example from site listed above
Note that there are some changes to the new version we are using and I sent you an email with modifications to the programs in the zipped file above.
Please especially note the insert changes. Sorry about that - I missed the fact that life had changed since last spring when it worked just fine!
These assignments will all be started in class if you attend class. Everyone must do them.
The first part of the assignment: You all need to take in a name in the format last/first middle and return the name first middle last. I suggest using strpos and substr to accomplish this. I will post the rest of the assignment later.
The second part of the assignment: 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. Note that for extra credit 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.
The third part of the assignment: Read the article at onlamp and convert the code to make it work for you - feel free to clean it up if you would like. I need you to create the database table to hold the images and then create the ability to update the database.
Week #11
Week of November 16th
Email examples
Handouts from last year (some duplicates):
Email examples
Email and DB example
This week we are going to start looking at email.
1) I want you to send me an email using a lot of features to make a nice looking message - images, lists, tables etc. 2) I want you to send me the address to a form that takes in information, puts it on a database and thanks me. 3) I also want you to use the account to send me a email from a database.
Week #10
Week of November 9th
I will be available Tuesday at 11:00 and 2:00 in K101. Thursday I am available at 11:00 and at 3:00 in K101. Friday you need to contact me for availability. If those times don't work, contact me and we can try to set up something else.
We will continue with connections this week and look at updating the database.
Update connect examples
Update html and php examples
We are going to continue to look at connecting to databases and we will start looking at images in a database.
Working with images
Images address on database
Another random image example
Quiz on databases and images
Your assignment is to write code to update a database table. I want you to let the user choose whether they want to add, change or delete. I then you want to take in the needed data and make the add, change or delete happen.
Week #9
Week of November 2nd
I will be available Tuesday at 11:00 in K101 and also at 2. I will also be available Thursday at 11 and at 3 in K101. Friday I am available at 11 in my office. Check with me for times if you are interested in staying Friday.

We will continue to work on connecting between PHP and MySQL. So please check back.
Third set connect examples
List columns, create table, drop table code
Fourth set connect examples
I want you to experiment with connecting and retrieving information from database tables. I want 4 different programs that include displaying all the records, displaying a particular record, and display from multiple tables and something you want to try.
Week #8
Week of October 26th
I will be available Tuesday at 11 and from 2 to 2:30 and Thursday at 11 and at 3 and Friday at 11 in my office. This week, you should take a quick look at connecting from PHP to a MySQL database. Please experiment with these examples.
Connect examples
More connect examples
Your assignment is to write a guess the number game using the structure that I used in the showbinary and binhex examples.
Week #7
Week of October 19th
I am away at a conference much of this week. My only available time is Tuesday at 11.
Sorry I have gotten behind in correcting - we all need to work on this - you getting assignments in and me getting them back!
No notes for Thursday, I was out sick.
Global variables PHP
We will start looking at arrays this week.
We came across a problem insert an array value in the string we wanted to put out with echo or print. A little research shows the solution - you need to enclose the value coming from the array in curly braces.
echo("$ct1 + $ct2 = {$mathArray[$ct1][$ct2]}<br>");
More on Arrays
I want you to write a program similiar to the one I wrote which can be run from: Math Array
The statements Multiply by 0, Multiply by 1 are stored in an array. You need to extract the message from the array and display it before you show each group. The answer that you extract and display is stored in a 2 dimension array with the two multipliers being the indexes that allow you to extract the answer. You should use a nested while loop to do this.
Week #6
Week of October 12th
This week I am available Thursday at 11 and 3 in K101 and Friday at 11 in my office.. We will look at a little more SQL and then we will go back to looking at PHP.
Keys and indexes
Analysis of showbinary.php: I want you to give a detailed analysis of the program showbinary.php. In the process, I want you to look for errors and suggest fixes if you find any.
Week #5
Week of October 5th
Help/support labs on Tueday and Thursday at 11 in K101 and 3:00 in K101.
Please read the information in your text on using SQL with MySQL and find other resources to help.
We will continue looking at SQL and take a look at relational databases. Check back!
W3Schools SQL
SQL tutorial
Another SQL tutorial
Another SQL tutorial
MySQL assignment: Second SQL assignment
Again, for those who took Oracle, please notice the similarities and differences.
Week #4
Week of September 28th
I taught this class as an inclass course with captured lectures and Smartboards last spring. If you look under audio and Smartboard you will find the notes. This class is very much a parallel of that class, so you can check back if you feel it would be helpful.
I will be around at 11 on Tuesday and Thursday, at 3 on Thursday in K101. I usually stay late on Friday. Get in touch if you want to meet with me.
The Boston Public Library has a special offer that allow you to go to their site and read a large number of books on line - you can go to their site at and signup. Then you can find books about web development to read.
This week we are going to focus on setting up MySQL on a server and querying and maintaining it. 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
If you want a copy to work with at home, a copy is available on the CDs accompanying the text book or at this site.
Please look at the presentations under MySQL on using MySQL. 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
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. I have sent the names of the databases to your BCC accounts.
We got through most of the PowerPoints on SQL (note you should unzip and look at the zipped versions, there are problems with the stand alone versions).
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.
Week #3
Week of September 21st
I am available for help Tuesday at 11 in K101. I am also available Thursday at 11 in K101 and at 3 (my office K112) and on Friday at 11 and 1-1:30 (my office). Note there may be a note on my door telling you I am in a lab.
Be sure you have gone over the condition examples and are comfortable with if statements. This week we are going to look at the Boston Tea Party example and then we will look at other if structures.
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 week. I really think of the textbook largely as a reference.
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
Note - I have a factual error in my expedition - actually it was a programming error but it comes out as a factual error!
Please note that the four lines we used in HTML can present problems in php, specifically there is a problem with the less then - question mark - xml. Do a little research and read about the issues.
I would like you to write a history game for kids (make yours accurate!). It should be something along the lines of what I did for the Boston Tea Party.
Week #2
Week of September 14th
Handout on using WinSCP3 Note that there is a later version available if you choose to use it.
Please look at the beginning PHP examples and the beginning PHP PowerPoints. The examples are under Beginning PHP examples and begin cont PHP. They are zipped. The presentations are under PHP fundamentals and are called Beginning PHP and Beginning PHP continued. More PHP examples
You should also read chapter #1 and start reading chapter #2 in the PHP 5/MySQL Programming text book. Note that you are doing PHP and MySQL on our server so you do not have to attempt to set up.
Example using print and echo
We are going to look at if statements this week: The examples are nested in with Boston Tea Party. I would also recomment looking at this presentation:
Presentation on logical if structures
    Separate speaker notes to accompany presentation on logical if structures
First PHP assignment
Put this up on the web when I get you your login and password.
Week #1
Week of September 7th
Read chapter #1 in PHP/MySQL Programming. We will start off the semester with HTML/XHTML. If you have already had CIS44 or have previous experience, this will be a review. If you have taken CIS17, you have already been introduced to HTML. For others I suggest that you read chapter #1 carefully and use resources at the page for CIS44 or other resources on the web to accquaint yourself with HTML.
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 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.
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!
Due in two weeks. Hopefully I will have your server login information soon - if not we will extend the due date.
As always, check back!


Send e-mail to Mrs. Grocer:

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