ok here is an example that someone gave me...it
works..it splits up the file but it comes out as

$data_values[0] = Something
$data_values[1] = SomethingElse
$data_values[0] = SomethingMore

$data_values[0] = Something
$data_values[1] = SomethingElse
$data_values[0] = SomethingMore

and so on

how do I get this to where its $Something,
$SomethingElse, $SomethingMore

thanks...


<?PHP

$fp = fopen("test.txt","r"); 
$file = fread($fp,filesize("test.txt")); 
fclose($fp); 

$records = explode("\n\n\n\n\n",$file); 
foreach($records as $record_num => $data) { 
$data_values = explode(" - ",$data); 
foreach($data_values as $data_num => $record) { 
echo "\$data_values[$data_num] = $record<br><p>"; 
} 
} 


?>
--- Jack Dempsey <[EMAIL PROTECTED]> wrote:
> checkout http://php.net/manual/en/function.file.php
> 
> -----Original Message-----
> From: Dominica Anderson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 20, 2001 2:14 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] importing text file
> 
> 
> I have a text file that is formatted as such 
> 
> Something - SomethingElse 
> <4 blank lines> 
> SomethingMore 
> <4 blank lines> 
> Something - SomethingElse 
> <4 blank lines> 
> SomethingMore 
> <4 blank lines> 
> and so on 
> 
> Anyone have any ideas on what I would use to get
> this
> into seperate 
> records that are $Something, $SomethingElse,
> $SomethingMore for displaying 
> in php or even importing into mysql? 
> 
> I would even go for $Something and just
> $SomethingMore
> with $Something 
> really being $Something-$SomethingElse. I don't know
> if that makes sense. 
> 
> Any help would be greatly appreciated.
> 
> 
> __________________________________________________
> Terrorist Attacks on U.S. - How can you help?
> Donate cash, emergency relief information
>
http://dailynews.yahoo.com/fc/US/Emergency_Information/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to