I'm using jpgraph to generate GPA chart. the x-axis is for the GPA value, while the y-axis is for the year/semester.

my problem is : i fetch the value for both x-axis and y-axis element from the database. i pack all elements in an array variable using array_unshift(). everything is okay but it came error like this

Empty input data array specified for plot. Must have at least one data point.

Here's my code

$id=$_GET['id'];
$smtThn=array();
$ip=array();

$query="SELECT * FROM sksips WHERE sksips.id_student='$id' GROUP BY semester";
$result=mysql_query($query);

//fetch the data from dB
while($data=mysql_fetch_array($result)){
//store data (sksips.id_semester) into array $smtThn
	
	array_unshift($smtThn,$data['semester']);
	array_unshift($ip,$data['ip']);
}
// trial code
//array_unshift($smtThn,1,2,3,4,5);
//store IP data into array $ip
//	array_unshift($ip,3.25,3.44,3.0,3.9,3.8);

when i run the trial code, it works fine. but, when i fetch from the database it doesn't work. Any idea?? thanks :)

oh my God!! JPGraph is innocent. the suspect was the parameter :p. the parameter (id) hadn't been passed. so the query didn't work.

Note: JPGraph is innocent in this case :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.