Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi,

I have a feedback form(rating system from 1-5) coded in php which stores data in mysql. Now I want to create a graph of average ratings.

I have no idea of how to fetch data in a php as a graph from mysql so that it shows the average rating.

Thanks

This is my php form

PHP
<title>process</title>
 "") print mysql_error() . "";
mysql_select_db($database_name, $db);
if (mysql_error() > "") print mysql_error() . "";
$waiting = $_POST['radio1'];
$consultation = $_POST['radio2'];
$preoperative = $_POST['radio3'];
$specialists = $_POST['radio4'];
$assistants = $_POST['radio5'];
$painful = $_POST['radio6'];
$operatingroom = $_POST['radio7'];
$thought = $_POST['radio8'];
$recommend = $_POST['radio9'];
$suggestions = $_POST['suggestions'];
$query = "insert into feedback (waiting, consultation, preoperative, specialists, assistants, painful, operatingroom, thought, recommend, suggestions) values ('" . $waiting . "', '" . $consultation . "', '" . $preoperative . "', '" . $specialists . "', '" . $assistants . "', '" . $painful . "', '" . $operatingroom . "', '" . $thought . "', '" . $recommend . "', '" . $suggestions . "')";
if (mysql_error() > "") print mysql_error() . "";
$qresult = mysql_query($query);
echo "Thank you for submitting your details!";
?>
Posted
Comments
Mohibur Rashid 30-Jul-13 21:00pm    
so, you want to create graph, you can create an image using php image related function and draw your graph on the image....
ZurdoDev 30-Jul-13 22:28pm    
I don't know php but I do know google has an api that you can pass parameters to and it creates a graph image for you.

1 solution

Use jqPlot plugin as your graph tool.You can have documentation from

http://www.jqplot.com/docs/files/usage-txt.html[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900