Re: fgets function for very large files
| From: | Ashley Sheridan | Date: | Sat, 23 May 2009 06:58:43 +0000 |
| Subject: | Re: fgets function for very large files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-293004@lists.php.net to get a copy of this message | ||
On Sat, 2009-05-23 at 10:41 +0430, shahrzad khorrami wrote:
> hi all,
>
> I have a csv file with more than 100,000 lines. I want to insert each line
> as a record in a
> database. but for the reason of very number of lines,
> I put a button with caption Next, when we click on it, 1000 line will
> insert into db and then again click next button
> and insert next 1000 line and....
> is this good way? what do you recommend? and how can I do that?
>
>
> Thanks in advance,
> shahrzad
If it's a CSV, I'd recommend using phpMyAdmin directly to import it into
the database, assuming you are using a MySQL database that is. It's
using tried and tested code for large files like that.
Ash
www.ashleysheridan.co.uk