Which Checks have Cleared: ALTER TABLE

We will need to alter the table to add a field for cleared. This will be Boolean as it will only have values of true or false. Execute this command in the database query page:

ALTER TABLE Checking ADD Cleared BOOLEAN DEFAULT FALSE
Then we can add a form to list all of the transactions between two dates and check off everything that has cleared.

Editing

We will create a form that display all of the transactions between two dates. When this is working, for each transaction we will add a button to edit that transaction.

Modify InsertDate

We have a function that can add a date to the form, but the fields are called Month, Day, and Year. To select two dates we need MonthStart, DayStart, and YearStart for the start date and MonthEnd, DayEnd, and YearEnd for the ending date. We can modify this function to add an optional argument called id. We will change the function to print <select name="Month'.$id.'" id="Month'.$id'"> If $id is a null string it will just display <select name="Month" id="Month"> but if we pass "Start" as the id it will print <select name="MonthStart" id="MonthStart">

if(!function_exists("insertDate")) { //adds an optional id: for example MonthStart, DayStart, and YearStart
 function insertDate($year,$month,$day,$id="") { //pass year, month, and day as arguments, optional id
   $months=array("","January","February","March","April","May","June","July","August","September","October","November","December");
   echo '<select name="Month'.$id.'" id="Month'.$id'">';
   echo '<option value="'.$month.'" selected="selected">'.$months[$month].'</option>'; //make the month passed the default
   for($m=1;$m<=12;$m++) { //use an array to display all of the months
      echo '<option value="'.$m.'">'.$months[$m].''</option>';
   }
   echo '</select>';	
   //the day and year are modified the same way

See the modified function.


INDEX, Problem Statement, Useful function for forms with dates, The Form for new Transactions, A Few Little Problems, Which Checks have Cleared: ALTER TABLE, Optional Arguments, Creating a table, Download the Checking Project
Next lesson: FilesMAIN INDEX
EXAMPLES INDEX

Copyright © Zebra0.com
All rights reserved worldwide.

 
 

Which Checks have Cleared: ALTER TABLE