gpt4 book ai didi

php - 使用php在mysql中上传csv文件时

转载 作者:行者123 更新时间:2023-11-29 20:53:46 25 4
gpt4 key购买 nike

当我在 MySQL 中使用 php 编码上传 csv 文件时,所有行和列都在插入。我其中有 670 条数据,但它插入了 1000 行,我只想添加 670 行

最佳答案

请检查以下代码希望这对您有帮助

  $count=0;
while(($data = fgetcsv($inputfp, 4096, ',')) !== FALSE) {
if($count==670) Break;
else{
//your inserting code here
}
$count++;
}

关于php - 使用php在mysql中上传csv文件时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37803308/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com