I am trying to take a rather large CSV file and insert it into a MySQL database for referencing in a project. I would like to use the first line of the file to create the ta
\n";
for($i = 0; $i <= count($fieldList); $i++)
{
if(strlen($fieldList[$i]) == 0) $typeInfo = 'varchar(80)';
if(preg_match('/[0-9]/', $fieldList[$i])) $typeInfo = 'int(11)';
if(preg_match('/[\.]/', $fieldList[$i])) $typeInfo = 'float';
if(preg_match('/[a-z\\\']/i', $fieldList[$i])) $typeInfo = 'varchar(80)';
echo "\t".'`'.$i.'` '.$typeInfo.' NOT NULL, -- '.gettype($fieldList[$i]).' '.$fieldList[$i]."
\n";
}
echo ' PRIMARY KEY (`0`)'."
\n";
echo ') ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;';