=====
CS 328 - Week 11 Lecture 1 - 2025-04-07
=====

=====
TODAY WE WILL
=====
*   announcements
*   writing a PHP function to hide connection complexity
*   review: handling a query
    ...that returns multiple rows
    ...but in a postback PHP!
    ...but to populate the options in a select/drop-down form widget!

*   and let's use a BIND variable to more-safely build a
    dynamic query based on the user's choice!

*   prep for next class
    
=====
*   should be working on Homework 9!
    *   at-least-1st-attempts due by 11:59 pm on Friday, April 11

*   should be reading and working through the activities
    in zyBooks Chapter 5 - PHP Fundamentals

=====
SIDE NOTE: if you are considering taking Humboldt courses in SUMMER 2025
=====
*   registration for SUMMER 2025 opens for ***EVERYONE*** on APRIL 14!!!!

*   from:
    https://www.humboldt.edu/student-financial-services/summer-term-2025

    "For the 2025 Summer term, the university is guaranteeing 4 units,
    if enrolled in 6 or more units, will be covered for all continuing
    matriculated undergraduate students. This will cover 4 units of
    the tuition charge and does not include coverage of mandatory
    campus-based fees or the additional non-resident tuition if
    applicable."

    *   see the above link for more information!

=====
UPCOMING SCHEDULE
=====
*   TODAY - more PHP-and-OCI

*   Wednesday, April 9 - review for Exam 2 (clicker questions included!)

*   Thursday, April 10/Friday, April 11
    *   There WILL be a Week 11 lab exercise!

*   11:59 pm Friday, April 11
    *   at-least-first-attempts at Homework 9 problems due

    *   deadline for credit for zyBooks Chapters 3, 4, 5 activities

*   Monday, April 14 - more PHP-and-OCI (the newly-intro'd parts will
    NOT be part of Exam 2)

*   11:59 pm Monday, April 14
    *   any final improved versions of problems from 
        Homeworks 6-9 are DUE, so that...

*   12:01 am Tuesday, April 15
    *   selected EXAMPLE SOLUTIONS for Homeworks 6-9
        can be made reachable on Canvas, for Exam 2 study use

*   Wednesday, April 16 - Exam 2, during lecture, in SH 108
    *   Exam 2 - Bonus must be submitted *ON CANVAS* by 3:00 pm
        on Wednesday, April 16

*   Thursday, April 17/Friday, April 18
    *   There WILL be a Week 12 lab exercise!

*   (Homework 10 comes out AFTER the Week 12 Labs)

=====
*   built a PHP function in an external PHP file to
    make setting up a connection (to the PHP document
    owner's Oracle student account) more convenient;

    *   see the resulting PHP function hum_conn_no_login
        in file hum_conn_no_login.php

    *   note how it uses an <code>exit;</code> statement
        to end the current (calling) PHP document
	immediately if an Oracle connection is not
	successfully made

    *   note how it uses require_once to include the
        html-template.html's footer, and body and html
	end tags, when we want them

    *   see how require_once is used to include the file
        hum_conn_no_login.php containing the function
	hum_conn_no_login once in the head element of
	328lect11-1-empl-request.php,
	
	so the function hum_conn_no_login can then be called
	as desired in the body element of
	328lect11-1-empl-request.php

=====
*   see 328lect11-1-empl-request.php to see another
    postback PHP that either creates a desired form
    or responds to that form when it is submitted

    *   note how it DYNAMICALLY builds the option elements
        for its select/drop-down form widget of employee
	numbers and last names --

	this is a GOOD approach, since any changes to employees
	(insertions, deletions, updates) require NO changes
	to the PHP code building this select/drop-down form widget!
	
	...each time this PHP is executed, it selects the CURRENT empl
	   table's contents and uses them to build this select/drop-down!

    *   note how it uses a BIND VARIABLE to thwart SQL INJECTION, 
        to more-safely build a DYNAMIC select statement asking for
        information about the selected employee when its form is
        submitted --

        SEE the posted handout "Basics of Oracle/PHP Bind Variables"
	for important basics you NEED to know about SQL injection
	and Oracle/PHP bind variables!