php - Foreach continous loop using file() function. -


$lines = file('array2.txt');     foreach($lines $line)     {         mysql_query("insert test (tweet, date) values ('$line', '22')");     }  

hi all,

i trying use code above use file() function add lines text file array, can place in mysql database. file using contains 100 lines, using function above end on 116,000. known how causing this? thank in advance.

maybe try way. read till file end line.

$file = fopen("file.txt", "r"); while (!feof($file)) {     $line = fgets($file);     // code make db insert } fclose($file); 

for me works, , don't other records, 10 wrote in.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -