Problem is reading text from file and prepare and save specific text to variables for insert into database. Something like here: https://www.wdb24.com/php-read-text-file-and-insert-into-mysql-database/
Measurment/Import data looks like:
1=19-10-18 10:02:06
2=+1.313026E+00 l/s
3=+1.671796E-01m/s
4=+1.500691E+02m3
5=+1.501138E+02m3
6=+0.000000E+00m3
1=19-10-18 10:03:06
2=+1.266786E+00 l/s
3=+1.612923E-01m/s
4=+1.501403E+02m3
5=+1.501850E+02m3
6=+0.000000E+00m3
1=19-10-18 10:04:06
2=+1.597391E+00 l/s
3=+2.033861E-01m/s
4=+1.502291E+02m3
5=+1.502738E+02m3
6=+0.000000E+00m3
.
.
.
Always only the first three rows (1=...2=...3=...) from six repeatedly rows need to store in variable like $first, $second, $third. Like array maybe, because I need to save text data in ONE FIELD in database
$first=19-10-18 10:02:06,19-10-18 10:03:06,19-10-18 10:04:06 //from 1=
$second=+1.313026E+00,+2.333026E+00,+2.123026E+00 //from 2=
$third=+1.671796E-01,1.87794E-01,1.34146E-01 //from 3=
I have small part of code, please someone help with preparing data (inserting in database is not problem).
<?php
$file=fopen("test_file/test.txt", "r");
while(!feof($file)){
$content=fgets($file);
$content=explode(PHP_EOL,$content); //break line?
//list($first,$second,$third,$four,$five,$six)=$content;
var_dump ($content); //result is some strange array, can't call $content[0] in some loop...
}
fclose($file);
?>
Result is some strange looking arrray or not? I am php beginer, thanks in advance for any suggestion, link...
If you wonder what is the end product, it's google chart that reads data from database. I think it's inconvenient to have table for every measurment and plan is to store it in like:
id | timestamps | values1 | values2
1 | many times | manyValues | manyValues
2 ............
So in this case there is only one tabel with many measurments.