Pć Tue, 24 Feb 2004 11:27:58 +0100, skrev Boris ©avc
<bo********@odis-info.com>:
How do I read data from file with delimiters (for instance
A;B;ccc;S45A;UU)?
I'd like to write that data to MYSQL table...
This is -one- way of doing it:
$lines = array(); //Create an array.
$lines = file("my_delimed_data_file.dat");//Load the lines into the array.
foreach($lines as $line) { //Loop through the array.
list($field1,$field2,$field3,$field4,$field5) = explode(";",$line);
//Extract your vars from the line.
mysql_query("INSERT INTO your_table ('field1',___,'field5')
VALUES(".$field1.",___,".$field5.")"); //Insert them into the db.
}//End of loop
The ___ part is of course just "fill in the blanks yourself".
The code is of course not complete, but you get the general idea.
--
Fred H
void FredH::Contact() {
TextToSpeach.say("frode at age dee dee dot en oh");
}