OK
trying to create a scatter graph by using JPGraph (example file sctterex1.php)
the graph is created from the values in the uploaded CSV file
I get the values from CSV file using this function
[code=php]
<?php
function read_csv_file($file_to_read){
# Open the File.
if (($handle = fopen($_FILES[$file_to_read][‘tmp_name’], “r”)) !== FALSE) {
# Set the parent multidimensional array key to 0.
$nn = 0;
while (($data = fgetcsv($handle, 1000, “,”)) !== FALSE) {
# Count the total keys in the row.
$c = count($data);
# Populate the multidimensional array.
for ($x=0;$x<$c;$x++)
{
$csvarray[$nn][$x] = $data[$x];
}
$nn++;
}
# Close the File.
fclose($handle);
}
# Print the contents of the multidimensional array.
return $csvarray;
}
?>
which if kept in functions/read_csv_file.php
yet, when I run
[code=php]require_once (‘functions/read_csv_file.php’);
the graph returns an error
Here’s the code for the page as it is now
[code=php]
<?php // content=”text/plain; charset=utf-8″
// Some data for the points
$data = array();
//$datax = array();
//$datay = array();
switch (true){
case (isset($_FILES[‘csv’][‘tmp_name’])):
require_once (‘../jpgraph.php’);
require_once (‘../jpgraph_scatter.php’);
require_once (‘functions/read_csv_file.php’);
require_once (‘functions/create_scatter_plot.php’);
$data = read_csv_file(‘csv’);
$datax = array(3.5,3.7,3,4,6.2,6,3.5,8,14,8,11.1,13.7);
$datay = array(20,22,12,13,17,20,16,19,30,31,40,43);
//create_scatter_plot($datax, $datay);
break;
default:
echo’
<html>
<head>
<title>read uploaded csv file</title>
</head>
<body>
<form action=”scatter.php” method=”post” enctype=”multipart/form-data”>
<input name=”csv” id=”csv” type=”file”>
<input type=”submit” name=”send” id=”send” value=”Submit”/>
</form>
</body>
</html>
‘;
break;
}
?>
any ideas