简体   繁体   中英

While uploading csv file in mysql using php

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

Please check below code hope this help you

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM