我试图阅读一个文本文件。
这是我的文本文件的示例:
"20130228","0000079511","ESTEVES PAIVA TERESA HELENA","","4","PAGO UNICO","","","","","",0.00,0.00,0.00,0.00, 2000.00,"20121213"
正如你可以想象的那样,我有这两个日期 20130228 和 20121213,第五列是一个数字,但是当我读取文件并在我的数据库中填写表格时,我在每个日期都得到 00-00-0000,而 0 而不是数字 4。
这是我在表格中读取和插入信息的代码:
if ($type == "text/csv") {
move_uploaded_file($temp, "upload/$name");
$fp = fopen("upload/$name",'r') or die("no se puede abrir el archivo");
do {
if ($data[0]) {
mysql_query("INSERT INTO contacts (fecha_pago, cedula_alumno, nombre_alumno, mencion, codigo_forma) VALUES
(
'".addslashes($data[0])."',
'".addslashes($data[1])."',
'".addslashes($data[2])."'
'".addslashes($data[3])."'
'".addslashes($data[4])."'
)
");
}
} while ($data = fgetcsv($fp,1000,",","'"));
在此先感谢您的帮助