<?php
/*
* Some cases of use
* @package Csv2Db
* @date 2005-08-08
*/
require("_preload.php");
try {
$Csv2Db = new Csv2Db("test.csv", $separator = ";", $charset = "cp1250", $useconfig = true);
echo "Processing...<br/>";
flush();
$Csv2Db->dbWrite();
}
catch (Exception $e) {
echo "<hr />";
echo "Exception code: <font style='color:blue'>". $e->getCode() ."</font>";
echo "<br />";
echo "Exception message: <font style='color:blue'>". nl2br($e->getMessage()) ."</font>";
echo "<br />";
echo "Thrown by: '". $e->getFile() ."'";
echo "<br />";
echo "on line: '". $e->getLine() ."'.";
echo "<br />";
echo "<br />";
echo "Stack trace:";
echo "<br />";
echo nl2br($e->getTraceAsString());
echo "<hr />";
exit;
}
echo "CSV file was Succesfully transfered to database table.<br />";
echo "Record has ". $Csv2Db->getRowsCount() ." rows.<br />";
?>
|