What's wrong with my script ?
| From: | Vadee Prudon | Date: | Thu, 20 Jul 2000 12:38:02 +0000 |
| Subject: | What's wrong with my script ? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-25209@lists.php.net to get a copy of this message | ||
Hai,
I've got an problem, I want to upload an csv file and import automatic the
data into my mysql database.
I made the next script but got an error on line 25 (that's my query).
Can someone help me ? Or is there an better way to get data out of Filemaker
Pro into MySQL ?
<?
include "include/mysql_support.inc.php3";
include "include/layout.inc.php3";
commonHeader();
?>
<?
$row = 1;
$fp = fopen ("test.csv","r");
while ($data = fgetcsv ($fp, 1000, ","))
{
$num = count ($data);
print "<p> $num fields in line $row: <BR>";
$row++;
for ($c=0; $c<$num; $c++)
{
print $data[$c]. "<BR>";
}
}
fclose ($fp);
?>
<?
$Query = "INSERT INTO news (title,description, date) VALUES
($data[0],$data[1], $data[3])";
mysql_exec($Query);
?>