Part 2

21
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

description

 

Transcript of Part 2

Page 1: 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

Page 2: Part 2

Has anyone seen this…

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

Page 3: Part 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

Page 4: Part 2

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 [email protected]

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

Page 5: Part 2

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

Page 6: Part 2

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

Page 7: Part 2

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

Chapter 3

Introduction to relational databases

and MySQL

Page 8: Part 2

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

MySQL is… Inexpensive

Fast

Easy to use

Portable

Page 9: Part 2

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

Page 10: Part 2

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

A command-line client

Page 11: Part 2

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

A web-based client

Page 12: Part 2

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

The Welcome page

Page 13: Part 2

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.

Page 14: Part 2

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.

Page 15: Part 2

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

Running a SQL script that creates a database

Page 16: Part 2

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

Page 17: Part 2

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

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

Page 18: Part 2

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

The Databases tab

Page 19: Part 2

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

The Structure tab for a database

Click the Browse icon…..

Page 20: Part 2

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!

Page 21: Part 2

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