| 
<?PHP
/*
 instantiate the class
 */
 include('csvdict.class.php');
 $dict = new csvDict;
 
 /*
 process the csv file
 we are using the file name for the table name
 we could provide our own table name...
 $dict->processCSV('sample.csv','myTable');
 */
 $dict->processCSV('sample.csv');
 
 /*
 inform class of the primary column
 we are using the first field in the csv file as the primary column
 we could also name it, if the name is known...
 $dict->setPrimColumn('id');
 */
 $dict->setPrimColumn(0);
 
 /*
 inform class that primary column is auto incremented
 */
 $dict->isAuto = true;
 
 /*
 displaying data dictionary
 */
 $display = $dict->getDisplay();
 echo $display.'<hr>';
 
 /*
 displaying create table query
 */
 $query = $dict->getTableQuery();
 echo $query.'<hr>';
 
 /*
 displaying row insert queries
 the dataRows property will not be available if the includeData property is false
 */
 foreach( $dict->dataRows[0] as $key=>$data ){
 $query = $dict->getInsertQuery($key);
 echo $query.'<br>';
 }
 
 ?>
 
 
 |