PHP_MySQL Query

                          Exercise: PHP_MySQL Query

                          
Given:  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
  
Prepare, then invoke a php program to query and output Item data. Save the
   PHP script in the folder named xampp/htdocs; and to execute the script open
   a browser with the url: localhost/scriptName.php .
1. Within the PHP script, assign to the variable $db the value returned from
   instantiating a new database object with parameters for host("localhost"), 
   your userName, password, and database name. 

   
2. Assign to a variable named $sql a string for a SQL select statement to 
   project the nonKey columns for the row with id value 20625.   


3. Assign to $result the return value from having $db invoke query( ).


4. Then have $result invoke fetch_array() and assign the values returned to 
   $row, a php array variable. For the Item table, $row would be assigned 
   elements corresponding to id, name, cost and qty. Reference elements by 
   associative or numeric indexes. For example:  $name = $row['name'];

   
   
5. Output $row or the individual column values. Example: print("$name $cost");


6. Modify step 2 to select all columns, and repeat step 3.


7. Prepare a while statement to continue as long as values are returned from 
   a call to fetch_array(). During each iteration, output the column values.





   
   
8. Have $db invoke close( ) to close that database connection.


item.csv:
04505,Noodle Cutter,18.95,6
12016,Garlic Press,13.95,9
15303,Coffee Maker,16.95,6
16344,Nut Cracker,69.00,4
20625,Potato Stomper,2.95,8
22760,Butter Melter,4.95,6
23316,Cheese Press,209.00,1
31102,Copper Kettle,69.00,3
36103,Pepper Grinder,27.50,4
69206,IceCream Maker,199.00,6