pulling text from a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a text file that looks like the one below. I need to read the file into a database.
I was trying the script below but is not working can you help?

$lines = file_get_contents('clientlist1.txt');

$find="Address:";
$f= strstr($f,$find);
$separat="City:";
$ADDRESS = substr($f, 0, strpos($f,$separat));
$ADDRESS=ltrim($ADDRESS,"Address:");
$ADDRESS=trim($ADDRESS);
echo $ADDRESS;
echo "<br>";

$find="City:";
$f= strstr($f,$find);
$separat="State:";
$CITY = substr($f, 0, strpos($f,$separat));
$CITY=ltrim($CITY,"City:");
$CITY=trim($CITY);
echo $CITY;
echo "<br>";

Text File

Address:      5070 myaddress.
City:     mycity     State:     mystate    Zip:     97268
County:
Signers
Name:     my name

Address:      3925 myaddress.
City:     mycity2     State:     mystate2     Zip:     97268
County:
Signers
Name:     my name2

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux