【发布时间】:2013-01-17 05:29:24
【问题描述】:
我有一个 CSV 文件,我从 CSV 文件中读取数据,然后我想跳过 CSV 文件的第一行。其中将包含任何标题。我正在使用此代码。
while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE)
{
// Code to insert into database
}
当我将数据插入数据库时,不应将标题保存到数据库中。
【问题讨论】:
-
Please, don't use
mysql_*functions in new code。它们不再维护and are officially deprecated。看到red box?改为了解prepared statements,并使用PDO 或MySQLi - this article 将帮助您决定哪个。如果你选择 PDO,here is a good tutorial.
标签: php