Hi,
I am confused about whether I should be using just the
file() function or both fopen() function and the file() function.
I have a file that is a list of words in a text fle.
Now I want to be able to use it with a php script so I want to get it into a mysql database.
The file not comma separated it is just a simple list
like this:
athrong
athrough
athumia
athwart
athwarthawse
athwartship
athwartships
How can I read these words and then insert them into a table ?
I have read "the manual".
From the description of the file() function in the manual, it
looks like I can just put the file into an array and use it
straight away.
eg
But if that is the case - what is fopen() for ??
Can someone please help me understand this ?
Thanks
I am confused about whether I should be using just the
file() function or both fopen() function and the file() function.
I have a file that is a list of words in a text fle.
Now I want to be able to use it with a php script so I want to get it into a mysql database.
The file not comma separated it is just a simple list
like this:
athrong
athrough
athumia
athwart
athwarthawse
athwartship
athwartships
How can I read these words and then insert them into a table ?
I have read "the manual".
From the description of the file() function in the manual, it
looks like I can just put the file into an array and use it
straight away.
eg
Code:
while (( $data = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)) !== FALSE) {
do_stuff();
}
Can someone please help me understand this ?
Thanks
Comment