this is the format of my text file:
joe 1234asdc 7:51:00 2010-08-21 hi
john 543kjkj 7:45:00 2010-08-21 hello
rey 675jhgj 7:40:00 2010-08-21 nice
the fields are separated by spaces.. anyone help me on how to do the exact coding..
Moderator: General Moderators
Code: Select all
$lines = file('/path/to/file.txt');
foreach($lines as $line) {
$values = "'".implode("','", explode(' ', $line))."'";
// INSERT INTO table_name (field1, field2, field3, field4, field5) VALUES ($values)
}