Courtesy of Clayton Fyfe Lab 2 Runthrough
Highlights 1. Accessing and Using phpmyadmin 2. CRUD for phpmyadmin 3. Microsoft expression WEB 3 Overview 4. CRUD for PHP 5. Adding Files to the playground
Accessing and Using phpmyadmin
Go to https://playground.bradley.edu/register
Notice and Copy Your root Password! Proceed to phpmyadmin
*Extra*If you forget / already have a mysql account: Click Reset Password and follow the previous slide.
*Extra Slide* Setting phpmyadmin password. 1. Click your name 2. Click SQL 3. Type SET PASSWORD FOR *s_username* = PASSWORD( ); 4. Put your new password between the single quotes. 5. Hit go
How To Use phpmyadmin - Student Table Example
Click on your username in the left column
Specify the name, number of attributes for your new table, and hit go
Name, Type Attribute Slide Nullability, Primary Key Slide
Specify the Name, Type, And Length Of the attributes.
Specify the Nullability and which attribute is a Primary Key and hit save.the primary key should be a unique attribute about your table. Example: Student ID
Adding Attributes to a table. *Student Example* 1. Click the insert Tab In Your Respective Table 2. Insert your data in the Value column for the corresponding fields. 3. Hit Go to add the data to your table 4. *NOTICE* If the values you enter are longer than the length specified in the type column, your data WILL be TRUNCATED and part of your data will not be stored
Removing Attributes from a table. *Student Example* 1. Click Browse In Your Respective Table 2. Click the red X
Updating Attributes from a table. *Student Example* 1. Click Browse In Your Respective Table 2. Click the pencil 3. Update your fields 4. Hit Go
Microsoft Expression Web 3
When you first open it click new Site
1. Select One Page site, 2. specify it s address, 3. and name it.
In the bottom left is the objects attributes In the bottom right there is the layer function.
Drag and drop the layer into the white space in the center of Web 3
Hit split view in the bottom left, this allows us to see code and the webpage layout
Drag and drop a Text Input, notice how it makes a Form inside of the layer. This form encapsulates the input field. Enter some text prior to the field.
Notice how the code has changed. Notice how the new div has ID layer1. Also notice the new form within the layer. If you click on the layer, text field, form, or anything for that matter, It gets highlighted in the code.
It s recommended to rename the ID and text fields to become more understandable.
In your form add an action before the method. The name of the action should be the same as your respective php file. For example, in the new student form. I m creating a php file named: newstudent.php
Insert Input (Submit) and Reset (Submit) buttons in the toolbox column. Make sure they are placed within the form.
Add more layers and fields to make your site
PHP
Check out the samples on the syllabus I d highly recommend downloading the sample files on the course website as well. Php Walkthrough PHP Worked example
C.R.U.D Create, Read, Update, Delete
Here s a sample of my config.php In yours you d want to replace the db_user and database with your respective information. Example: A Student with the name John Smith $database = s_jsmith ; $db_user = s_jsmith ;
Here s a sample of my newstudent.php *Create* Replace the text inside of the $_Post with your corresponding text field name. Let s say I have a text field named Student_Name The field would be..$_post[ Student_Name ].
Here s a sample of myshowallcourses.php *Read* In this slide, we display all the Courses in a given semester.
Here s a sample of updatestudentname.php *Update* In this slide, we update a student's name based on their ID
Here s a sample of removestudent.php *Delete*
PHP Additional Information
PHP Variables in SQL Use variables to save information typed into text boxes so it can be used in SQL queries Ensure name given inside _POST matches the name given to the textbox in your html form. When using a variable inside of a SQL statement, place the variable in single quotes
PHP With Request Methods Ensure the same request method is specified in both the html form and the PHP script when retrieving information from an html form
SQL
SQL Join Statements If you find yourself stuck on SQL Statements, check out this tutorial by W3schools. It is very helpful, especially when it comes to learning about Joins W3Schools
Uploading the files to the playground
Download a file transferring program. Or access through the command Line Link to trusted programs Playground.bradley.edu ip addess: 136.176.70.240
SSH Secure client example * Click quick connect * Host Name: playground.bradley.edu User Name: *bradley username* Password: *bradley password*
Upload your files to the public_html Be sure to create a new folder in your public_html folder. Click the new folder button. Or right click on the right column and click new folder in the window.
Check your Webpage: playground.bradley.edu/~*username* Example: playground.bradley.edu/~jsmith I d recommend making a folder. So that way you still have access to the directory.
Test Your forms