ok, hier meine kompletten skripts, das ganze ist in der test-phase, ich hänge ja am CREAT TABLE ;-):
PHP-Code:
<?
$row = 1;
$file = "test.csv";
$fp = fopen ($file,"r");
WHILE ($data = fgetcsv($fp, 10000, "\n\r")){
$num = count($data);
echo "<p> $num fields in line $row: <br>\n";
$row++;
for ($i=0; $i<$num; $i++) {
$table_row = split(";",$data[$i]);
$table_cols = count($table_row);
//hier jetzt die includes:
include("dbconnect.php");
include("create_db_table.php");
for ($c=0; $c<$table_cols; $c++){
if(empty($table_row[$c])){
echo "-<br>\n";
} else {
echo $table_row[$c]."<br>\n";
}
}
}
echo "<hr>";
}
fclose ($fp);
?>
//und nu create_db_table.php:
<?
$table_name = "200305070939";
//$define = 'USE timo_test;';
$create = "CREATE TABLE" . $table_name. "( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, a VARCHAR(1) NOT NULL);";
//$create = 'CREATE TABLE $table_name ( `id` INT(2) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, `a` VARCHAR(1) NOT NULL, `b` VARCHAR(1) NOT NULL );';
$table_build = mysql_query($create);
echo $table_build;
?>
...
habe auchmal die bindestriche weg gemacht, obwohl ich immer noch nicht verstehe, warumd die
soo schlecht sind?!
gruß + dank ...