Example #1
0
  */
 while (!feof($file)) {
     $records[] = fgetcsv($file);
 }
 //closes the file
 fclose($file);
 if ($debug) {
     print "<p>Finished reading. File closed.</p>\n";
     print "<p>Contents of my array<p><pre> ";
     print_r($records);
     print "</pre></p>";
 }
 //Create tables if they dont exisit
 // -- Table structure for table `tblTeachers`
 $query = "DROP TABLE IF EXISTS tblTeachers";
 $results = $thisDatabase->delete($query);
 $query = "CREATE TABLE IF NOT EXISTS tblTeachers ( ";
 $query .= "fldLastName varchar(100) NOT NULL, ";
 $query .= "fldFirstName varchar(100) NOT NULL, ";
 $query .= "pmkNetId varchar(12) NOT NULL, ";
 $query .= "fldSalary int(11) NOT NULL, ";
 $query .= "fldPhone varchar(7) NOT NULL, ";
 $query .= "PRIMARY KEY (pmkNetId)";
 $query .= ") ENGINE=InnoDB DEFAULT CHARSET=utf8";
 $results = $thisDatabase->insert($query);
 $outputBuffer[] = "<p>tblTeachers Created.</p>";
 // -- Table structure for table `tblCourses`
 $query = "DROP TABLE IF EXISTS tblCourses";
 $results = $thisDatabase->delete($query);
 $query = "CREATE TABLE IF NOT EXISTS tblCourses ( ";
 $query .= "pmkCourseId int(11) NOT NULL AUTO_INCREMENT, ";