help with my school project

Hi fellow Yii coders,

I’m new to Yii so I need help and I will be very grateful for any ideas :)

I have already created skeleton app with everything I need but there is still one key function and without it will I be not successful.

I have .txt file with values and I need to save these values into MySQL database. Format of .txt file looks like this:

0; +22.50; +19.25; 38.30;

1; +22.50; +19.25; 38.25;

2; +22.50; +19.25; 38.25;

3; +22.50; +19.25; 38.35;

4; +22.50; +19.25; 38.20;

5; +22.56; +19.25; 38.20;

6; +22.63; +19.25; 38.35;

7; +22.63; +19.25; 38.25;

8; +22.56; +19.25; 38.30;

9; +22.56; +19.25; 38.30;

First value is ID second is the temperature of air, third is the temperature of soil and fourth is soil humidity.

Is there any extension that would help me? :)

Or maybe if any of you could write the code it would help me big time, I believe it is not too hard for skilled coders :)

The best solution for me would be a upload button where would I choose .txt input file with values and another button for example OK that would parse the file and save values into mysql table with 4 columns ID,air temperature, soil temperature and soil humidity.

Any ideas? Thanks in advance for every reply.

I attach the input file.

welcome to yii,

had a look This link will help you.

if anyone should do something like me there is my code:

<?php

include ("config.php");

mysql_connect(host,username,password);

mysql_select_db(database);

$file = file_get_contents(‘vzorka.txt’);

$var = explode(";", $file);

$pocet=count($var)-1;

$j=0;

echo "Hodnoty : ";

echo "<div>\n";

$tv=array();

for ($j=0;$j<$pocet;$j++)

{

if ($j % 4 == 1)

{

&#036;tv[]=&#036;var[&#036;j];    

}

}

print_r($tv);

echo "<div>\n";

$k=0;

$tp=array();

for ($k=0;$k<$pocet;$k++)

{

if ($k % 4 == 2)

{

&#036;tp[]=&#036;var[&#036;k];   

}

}

print_r($tp);

echo "<div>\n";

$l=0;

$vp=array();

for ($l=0;$l<$pocet;$l++)

{

if ($l % 4 == 3)

{

&#036;vp[]=&#036;var[&#036;l];         

}

}

print_r($vp);

$i=0;

for ($i=0;$i<count($tv);$i++)

{

mysql_query("INSERT INTO hodnoty(tv,tp,vp) VALUES($tv[$i],$tp[$i],$vp[$i])");

}

?>