RE: [PHP] 4th row in txt
| From: | Jack Dempsey | Date: | Mon, 21 Apr 2003 18:29:54 +0000 |
| Subject: | RE: [PHP] 4th row in txt | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144684@lists.php.net to get a copy of this message | ||
Hi Simon,
I'm not sure if you have much programming experience, but this should be an
easy for or while loop if you've done those before.
Using file [php.net/file] you can read the file into an array then loop
through the array, getting every 4th line and putting it into mysql...
One way to do this would be using the % (modulus) operator...
if( (($i+1) % 4) == 0){
//this is a row you want;
}
$i of course being the counter you loop through the resulting array from
file with...
HTH,
jack
> -----Original Message-----
> From: Simon [mailto:velikanka@hotmail.com]
> Sent: Monday, April 21, 2003 11:13 AM
> To: php-general@lists.php.net
> Subject: [PHP] 4th row in txt
>
>
> Hi,
>
> I have some txt files, that I would like to import to mysql. Format is:
>
> name
> last name
> city
> year
>
> How can PHP "select" only 4th row, and then put it into mysql.
>
> TNX
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>