I'm trying to import data from a csv file to some html code to use it in a graph I have already coded. I'm trying to use PHP and fgetcsv to create arrays for each separate piece of data to use PHP to put it into the html code. I know how to open the csv file and to print it using PHP, and how to print each separate row, but not each piece of data separated by a comma. Is there a way to do this?
If this helps, this is the csv data I am trying to import.
May 10,72,12,60
May 11,86,24,62
May 12,67,32,34
May 13,87,12,75
May 14,112,23,89
May 17,69,21,48
May 18,98,14,84
May 19,115,18,97
May 20,101,13,88
May 21,107,32,75
I hope that makes sense.
I'm trying to get the values into the following html code:
<dd class="pVALUE3"><span><b>VALUE3</b></span></dd>
<dd class="sub pVALUE2" ><span><b>VALUE2</b></span></dd>
so far my PHP code is:
<?PHP
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$date[$c] = $data[0]
echo "<dd class=\"p" . $data[2] . echo "\"><span><b>" . $data[2] . echo "</b></span></dd>
<dd class=\"sub p" . $data[3] . echo "\" ><span><b>" . $data[3] . echo "</b></span></dd>"
}
?>
But it's returning that there is an unexpected T_ECHO ...