This two day course is designed for people who have an elementary understanding of PHP and need to progress to using mySQL with this versatile server-side language.
In this intensive course you learn how to use PHP and MySQL together to produce the four basic database functions, Listing, Inserting, Updating and Deleting.
During the course you will learn how to use common PHP control structures and useful functions. There will be a simple introduction to relational tables.
While there are several styles of programming, the course goes to some length in discussing best practice using code that is easy to read and understand.
At the end of the course there will be a short discussion outlining where the delegate can move on to from this point, and these intermediate and advanced courses can be booked at Media Training.
Feel free to tailor the following course outline to your exact requirements if you wish.
Pre-Course Requirements: You need no previous experience to attend this course.
Creating a form handler
• Passing form data between pages
• Separate Vs integrated handlers
• Using $_POST and $_GET
• Using the if() control structure
• Using isset() to detect form input
• Presenting handler data
• Using header and footer scripts
• Using includes
• Configuring for errors
• Using error_reporting()
• Using comments to detect problems
• Using the echo command to view variables
Preparing to connect to mySQL
• Setting up database
• Using PHPmyAdmin
• Inserting dummy data
• PHP connection to db
• Writing a connection script
• Securing database credentials
Print out the table
• Arrays refresher
• Writing a query
• Using PHP to query the table
• Placing the data in an array
• Outputting the data
• Using the While Loop
Creating an Add Entry Script
• Creating a suitable form handler
• Stripping slashes
• Writing an INSERT query
• Checking for DB activity success
• Using the header() function
Creating a simple DB relationship
• Why use relationships?
• PKs and FKs
• Naming conventions
Creating an Update Script
• Passing the PK between scripts in a link
• Reading the PK and using it to display record
• Trapping non-standard use of form
• Using a SELECT drop down
• Linking the SELECT to table
• Passing the PK as a hidden field
• Writing an UPDATE query
Creating a Delete Entry script
• Using a form to validate entry
• Using the DELETE query
Where from here?
• Keeping code tidy
• Annotating code
• Security issues
• Data cleansing and validation
• Using functions and OOP
• Use of Sessions to authenticate users