How to read line by line in php

后端 未结 5 1286
北荒
北荒 2021-01-06 11:21

when i try to insert each line into my oracle database i get an error stating invalid number, but if have only one line in the file it works fine.

$file = @f         


        
5条回答
  •  青春惊慌失措
    2021-01-06 11:54

    Try this:

    $currentLine = trim(fgets($file)); 
    

    It's possibly failing on the newline/carriage-return at the end of the line.

    If not, where is this insert() function defined? Build a debug section that echos or writes out the attempted queries so you can really see the issue.

提交回复
热议问题