i have textfile containing multiple rows.Each row containing same type of strings.now my problem is i can read only one row frequently but i can't read multiple rows.
so how can i solve this problem Is there anybody expart to help me?
Text to be read is:
my
trial code is:[code=php]
<?php
$file = fopen("rawdata. txt","r");
while(! feof($file))
{
//echo fgets($file). "<br />";
$first=trim($fi rst.fgets($file ));
//echo $first;
}
$first1= substr($first,0 ,8);
echo $first1." ";
//mysql_query("in sert into test(name) values($first1) ");
//echo $first1;
/*$file1 = fopen("raw_da
{ta_31_03.txt", "rb");
while(! feof($file1))
//echo fgets($file). "<br />";
*/
//$second=trim($s econd.fgets($fi le1));
$second1= substr($first,9 ,7);
echo $second1 ." ";
$third= substr($first,1 7,5);
echo $third ." ";
$fourth= substr($first,2 3,2);
echo $fourth ." ";
$fifth= substr($first,2 5,11);
echo $fifth ." ";
$sixth= substr($first,5 0,15);
echo $sixth ." ";
$seventh= substr($first,7 7,2);
echo $seventh ." ";
fclose($file);
?>[/code]
so how can i solve this problem Is there anybody expart to help me?
Text to be read is:
Code:
03/31/02 04:21PM 136 11 9564499- 00:00'54 TR 03/31/02 04:22PM 202 10 8916116 00:00'05 03/31/02 04:23PM 125 08 108 00:00'32 03/31/02 04:23PM 142 06 <I> 0'00 00:00'31 TR 03/31/02 07:51AM 13 <I> 0'05 NA 03/31/02 04:22PM 202 10 9338340 00:00'00
trial code is:[code=php]
<?php
$file = fopen("rawdata. txt","r");
while(! feof($file))
{
//echo fgets($file). "<br />";
$first=trim($fi rst.fgets($file ));
//echo $first;
}
$first1= substr($first,0 ,8);
echo $first1." ";
//mysql_query("in sert into test(name) values($first1) ");
//echo $first1;
/*$file1 = fopen("raw_da
{ta_31_03.txt", "rb");
while(! feof($file1))
//echo fgets($file). "<br />";
*/
//$second=trim($s econd.fgets($fi le1));
$second1= substr($first,9 ,7);
echo $second1 ." ";
$third= substr($first,1 7,5);
echo $third ." ";
$fourth= substr($first,2 3,2);
echo $fourth ." ";
$fifth= substr($first,2 5,11);
echo $fifth ." ";
$sixth= substr($first,5 0,15);
echo $sixth ." ";
$seventh= substr($first,7 7,2);
echo $seventh ." ";
fclose($file);
?>[/code]
Comment