Thanks very much
I have a working preg_match solution for my intended (but not very well explained) purpose. You can see the final in the code below. I'm sure it looks very amateurish.. but it works for the most part thanks to your guidance.
Now my problem is that although my matches all work, I have a mysql insert problem. All values get inserted correctly into the database except for $data['notes'] (matched from Data 1: chunk). This seems odd. Any ideas?
No errors are displayed, and all other values are added to the record successfully. I can also confirm that $data['notes'] returns a result as I can echo successfully.
---
<?php
$contents = file_get_contents($my.txt);
preg_match('/^id: (.+)/m', $contents, $m);
list(,$data['id']) = $m;
preg_match('/^name: (.+)/m', $contents, $m);
list(,$data['name']) = $m;
preg_match('/^vendor: (.+)/m', $contents, $m);
list(,$data['vendor']) = $m;
preg_match('/^vendor_url: (.+)/m', $contents, $m);
list(,$data['vendorurl']) = $m;
preg_match("/Data 1:\s\.{3}\s(.*?)\.{3}/s", $contents, $m);
list(,$data['notes']) = $m;
$w1 = $data['id'];
$w2 = $data['name'];
$w3 = $data['vendor'];
$w4 = $data['vendorurl'];
$w5 = $data['notes'];
// Make a Connection
mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db("test") or die(mysql_error());
// Insert into the table
mysql_query("INSERT INTO table (id, name, vendor, vendorurl, notes) VALUES ('$w1','$w2','$w3','$w4','$w5')") or die(mysql_error());
?>
FYI - my text file that grab the data from
---my.text---
id: 1263294294
name: abc
vendor: def
vendor_url: www.abc.com
Data 1:
...
blah blah
blah
...
Data 2:
...
blah2 blah2
blah2
...
---my.text---
Thanks again. Hope no crystal balls this time. I'm trying...