Anush Posted June 17, 2014 Share Posted June 17, 2014 I need to convert the following table and graph to PDF when button is clicked. Please help I am using fusion charts and generated graph will be swf file // Table and graph for all students if(isset($_POST['ReportAll'])){ $strQuery = ("SELECT registration_number,SUM(Fine) AS Total_Fine FROM lended_book_cd GROUP BY registration_number"); $result=mysql_query($strQuery); if (!$result){ Error (mysql_error()) ; } if (mysql_num_rows($result)!==0){ $table=1; echo $input_table; echo "<center>Fine report for All Students </center>"; echo "<br>"; echo "<table border='2' align='center'>"; echo("<tr>"); for($i=0;$i<mysql_num_fields($result);$i++){ echo("<th>".mysql_field_name($result,$i)."</th>"); } while($data=mysql_fetch_array($result)){ echo("<tr>"); for($i=0;$i<mysql_num_fields($result);$i++){ echo("<td>".$data[$i]."</td>"); } } echo "</table>"; } else{ Info ("No Fine Reports found for Student $_POST[regnum]"); } $strQuery = ("SELECT registration_number,SUM(Fine) AS Total_Fine FROM lended_book_cd GROUP BY registration_number"); //Where lended_book_cd.registration_number = students.registration_number $result=mysql_query($strQuery); $strXML = "<graph caption='Fine report for All Students' showLabels='1' xAxisName='Student Registration Number' yAxisName='Fine Value' showNames='1' showValues='1' useRoundEdges='1' palette='3'>"; while($ors = mysql_fetch_array($result)) { // Append the names of the countries and their respective populations to the chart's XML string. $strXML .= "<set name='$ors[registration_number]' value='$ors[Total_Fine]' />"; } $strXML .= "</graph>"; echo renderChart('charts/FCF_Column2D.swf', // Path to chart type '', // Empty string when using Data String Method $strXML, // Variable that contains XML string 'chart1Id', // Unique chart ID '560', '400', // Width and height in pixels false, // Disable debug mode true // Enable 'Register with JavaScript' (Recommended) ); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.