RE: [PHP] What's wrong with this script ??

From: Date: Thu, 20 Jul 2000 12:57:08 +0000
Subject: RE: [PHP] What's wrong with this script ??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7408@lists.php.net to get a copy of this message
You need to put quotes around the values. > 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); > ?> > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#7408) next »