Can I specify the starting line when reading csv with the fgetcsv method in php?

<?php
    $conn = mysqli_connect(****);
    

    if (isset($_POST["import"])) {
        
        $fileName = $_FILES["file"]["tmp_name"];
        
        if ($_FILES["file"]["size"] > 0) {
            
            $file = fopen($fileName, "r");
            
            while (($column = fgetcsv($file, 10000, ",")) !== FALSE) {
                $sqlInsert = "
                    insert into users (userId,userName,password,firstName,lastName) 
                    values ("" . $column[0] . "","" . $column[1] . "","" . $column[2] . "","" . $column[3] . "","" . $column[4] . "")";
                $result = mysqli_query($conn, $sqlInsert);
                
                if (! empty($result)) {
                    $type = "success";
                    $message = "";
                } else {
                    $type = "error";
                    $message = "";
                }
            }
        }
    }
?>

how to specify the starting line when reading csv with the fgetcsv method in php?

Oct.21,2021

$file = fopen ("contacts.csv", "r");

while (! Feof ($file))
{
print_r (fgetcsv ($file));
}

)

fclose ($file);

)

? >

is read in a loop,
can not specify row reading
can also be implemented by iPP, and the efficiency is not good


< H1 > use the fseek function < / H1 >
fseek -locate
in the file pointer

although only locating to the specified byte is written in the document, you can see in the user's notes that many users have written a way to read the specified line.

A lot of this can be found by retrieving the line keyword.

someone even raised this question on stackoverflow from-a-file/15025877-sharp15025877" rel=" nofollow noreferrer "> performance-What is the best way in PHP to read last lines from a file?-Stack Overflow-.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e450df-4383c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e450df-4383c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?