PHP/MySQL                Exercise: Basic Database Report              Spring 2015


0. Given an Item table with the following specifications:
      Table Name      Column Name     Data Type     Length  Comment
      ----------      -----------     ---------     ------  ----------  
      Item:           id              int                5  primary key,
                      name            varchar           15
                      cost            decimal            5  2 dec. places
                      qty             int                1  quantity




                      
1. Establish a database connection:
   Assign to the variable $db the value returned by instantiating a new mysqli
   database object with parameters for host (e.g. "localhost"), userName, 
   password, and database(schema) name.
   

   
2. Define a variable named $sql and assign to it a string for a SQL statement
   to project needed columns from the item table.  
  

  
3. To execute the select statement, have $db invoke the function query passing 
   the parameter $sql. Assign the value returned from query() to a local 
   variable with a name such as $result.     



4. Define and initialize a variable for accumulating total cost from Item.
 


5. Code a repetition structure that repeats each time a nonNull query result
   is assigned to an array variable as $result invokes fetch_array(). Within
   the loop statement body include assignments of array elements to column 
   variables, a statement to format and print those variables, and accumulate
   a total for the decimal column.   


  
   
   
   
   
   
   
 


 
6. Print the total then have $db invoke close().



*  Enhance your program with formatted report heading, column headings, and
   and footing line with $totalCost (labeled; right-aligned).