Part 2

Post on 09-Dec-2014

918 views 2 download

Tags:

description

 

Transcript of Part 2

Loose Ends

• Anton’s World– http://www.deinega.com/baws

• An issue you may have seen…

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 1

Has anyone seen this…

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 2

What is going on?

• With current versions of PHP V5.3.8? and above, undeclared variable checking was implemented. [XAMPP Mac PHP V5.3.1 – not a problem]– Good programming tip: You cannot/should not use

a variable before initializing it.

• Look at the original code.• Look at the “better” code (bugs resolved).• Thanks to Jim for running that down.Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.

Slide 3

Assigned Homework

• Exercise 2-2, Enhancing the Future Value Application, p. 91 of the PHP & MySQL text.

• Download Netbeans IDE– Load project or two– Improve your skills!

• Debug the timestable.php

• Send the completed homework to mshrage@snet.net

Murach's PHP and MySQL, C2 © 2010, Mike Murach & Associates, Inc.Slide 4

HW: Timestables.php

• Who did the homework?• NetBeans

– Comments?– Thoughts?

• There was nothing wrong with timestables.php– Perhaps there was a caching problem

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 5

HW: Future Value Enhancements

• Testing the application– On your own

• Enhancing the validity checking– Note the original approach versus a different

approach– Should initialize our variables while we are there– Add interest rate less than 15% check– Add the date

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 6

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 7

Chapter 3

Introduction to relational databases

and MySQL

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 8

MySQL is… Inexpensive

Fast

Easy to use

Portable

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 9

MySQL provides… Support for SQL

Support for multiple clients

Connectivity

Security

Referential integrity

Transaction processing

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 10

A command-line client

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 11

A web-based client

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 12

The Welcome page

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 13

How to start phpMyAdmin on a local computer 1. From the XAMPP Control Panel, start the Apache and MySQL

servers if they aren’t already running.

2. Click the Admin button for the MySQL module to start the phpMyAdmin tool in your default web browser.

How to log in Enter your username and password.

How to log out and return to the Welcome page Click the Log out toolbar button (the Exit sign) that’s in the

sidebar of most pages. Or, go the Home page by clicking on the Home button, and then click the Log out link.

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 14

How to change your password Go to the Home page by clicking on the Home button. Then, click

the Change Password link.

On the Change Password page, enter and re-enter your new password, and click the Go button.

I have not found the Change Password link from the Homepage.

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 15

Running a SQL script that creates a database

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 16

How to import and run a SQL script 1. Click the Import tab, go to the “File to Import” section, click the

Browse button, and select the file that contains the script.

2. Click the Go button. This runs the script that’s in the file.

The script for creating the databases for this book \xampp\htdocs\book_apps\_create_db\create_db.sql

Let’s do this!And look at the script

• Let’s look at the results of the script execution…

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 17

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 18

The Databases tab

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 19

The Structure tab for a database

Click the Browse icon…..

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 20

The Browse tab for the categories table

Congratulations! You just ran your first SELECT query!

Homework

• Verify that you have installed the Murach databases correctly

• Begin to explore the Guitar Shop– Chapter 20 application

• Read Chapter 4 and 5 in the PHP_MySQL book• Read Chapter 2 in the Javascript book• Note: We did not get this far. This will be due not

next week but the week after…. – P.122, Exercises 8, 9, 10, 11, 12, 13

Murach's PHP and MySQL, C3 © 2010, Mike Murach & Associates, Inc.Slide 21