Richard Kurth wrote:
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
Never mined I forgot to change $line to $f
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php