wackyflik Posted October 7, 2006 Share Posted October 7, 2006 i've got some weird output like symbols when run these codes. what happened actually??[code]<?phpsession_start();if(isset($_SESSION['user'])) { $dateId = $_GET['id']; function generateGraph($year, $month){ include('../config_default.php'); include('../jpgraph/src/jpgraph.php'); include('../jpgraph/src/jpgraph_bar.php'); $sql = "SELECT f.facultyInitial, COUNT(*) AS Total FROM attendance att INNER JOIN academic a ON att.academicNo = a.academicNo INNER JOIN program p ON a.programId = p.programId INNER JOIN faculty f ON p.facultyId = f.facultyId WHERE MONTH(att.attendanceDate) = $month AND YEAR(att.attendanceDate) = $year GROUP BY f.facultyInitial ORDER BY f.facultyInitial"; $query = mysql_query($sql); $row = mysql_num_rows($query); if($row <> 0){ while($result = mysql_fetch_array($query)){ $data[] = $result['total']; $leg[] = $result['facultyInitial']; } $graph = new Graph(500,400,"auto"); $graph->SetScale("textint"); $graph->img->SetMargin(50,30,50,50); $graph->AdjBackgroundImage(0.4,0.7,-1); $graph->SetShadow(); $graph->xaxis->SetTickLabels($leg);// $bplot = new BarPlot($data);// $bplot->SetFillColor("lightgreen"); // Fill color $bplot->value->Show(); $bplot->value->SetFont(FF_ARIAL,FS_BOLD); $bplot->value->SetAngle(45); $bplot->value->SetColor("black","navy"); $graph->Add($bplot); $graph->title->Set("Numbers of Students"); $graph->xaxis->title->Set("Faculty"); $graph->yaxis->title->Set("No. of Students"); $graph->Stroke(); } else{ echo "<center><font face=\"Georgia, Times New Roman, Times, serif\" color=\"#000000\">Sorry, no record is found.</font></center>"; } } function splitDate($dateId){ $tempDate = explode('-', $dateId); /* * add 0 in front of the month if * month parameter is between 1 and 9 */ if($tempDate[1] >= 1 && $tempDate[1] <= 9) $tempDate[1] = "0" . $tempDate[1]; else $tempDate[1] = $tempDate[1]; generateGraph($tempDate[0], $tempDate[1]); } if(isset($dateId)){ splitDate($dateId); }}else{ echo "<br><br><center><font face=\"Georgia, Times New Roman, Times, serif\">Warning: You are trying accessing restricted page.</font></center>"; header("Refresh:2, url='../auth/login_form.html'");}?>[/code] Link to comment https://forums.phpfreaks.com/topic/23289-jpgraph-display-weird-thingssymbols/ Share on other sites More sharing options...
marcus Posted October 7, 2006 Share Posted October 7, 2006 i get[quote]Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\tests\5\a.php:80) in C:\wamp\www\tests\5\a.php on line 81[/quote] Link to comment https://forums.phpfreaks.com/topic/23289-jpgraph-display-weird-thingssymbols/#findComment-105577 Share on other sites More sharing options...
Orio Posted October 7, 2006 Share Posted October 7, 2006 This is your problem:[code]echo "<br><br><center><font face=\"Georgia, Times New Roman, Times, serif\">Warning: You are trying accessing restricted page.</font></center>";header("Refresh:2, url='../auth/login_form.html'");[/code]You cant have anything outputted before calling the header function.You may do:[code]header("Refresh:5, url='../auth/login_form.html'");echo "<br><br><center><font face=\"Georgia, Times New Roman, Times, serif\">Warning: You are trying accessing restricted page.</font></center>";[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/23289-jpgraph-display-weird-thingssymbols/#findComment-105578 Share on other sites More sharing options...
wackyflik Posted October 7, 2006 Author Share Posted October 7, 2006 nope...nothing change...but how come these codes work? i used this code when trying jpgraph which is taken from phpfreaks.[code]<?phpini_set('display_errors', 1); error_reporting(E_ALL); session_start();if(isset($_SESSION['user'])) { include('../config_default.php'); include('../jpgraph/src/jpgraph.php'); include('../jpgraph/src/jpgraph_bar.php'); $year = 2006; $sql = "SELECT COUNT(*) total, f.facultyInitial FROM attendance att INNER JOIN academic a ON att.academicNo = a.academicNo INNER JOIN program p ON a.programId = p.programId INNER JOIN faculty f ON p.facultyId = f.facultyId WHERE YEAR(att.attendanceDate) = $year GROUP BY (f.facultyId) ORDER BY f.facultyInitial"; $query = mysql_query($sql); $row = mysql_num_rows($query); if($row <> 0){ while($result = mysql_fetch_array($query)){ $data[] = $result['total']; $leg[] = $result['facultyInitial']; } $graph = new Graph(500,400,"auto"); $graph->SetScale("textint"); $graph->img->SetMargin(50,30,50,50); $graph->AdjBackgroundImage(0.4,0.7,-1); $graph->SetShadow(); $graph->xaxis->SetTickLabels($leg);// $bplot = new BarPlot($data);// $bplot->SetFillColor("lightgreen"); // Fill color $bplot->value->Show(); $bplot->value->SetFont(FF_ARIAL,FS_BOLD); $bplot->value->SetAngle(45); $bplot->value->SetColor("black","navy"); $graph->Add($bplot); $graph->title->Set("Numbers of Students"); $graph->xaxis->title->Set("Faculty"); $graph->yaxis->title->Set("No. of Students"); $graph->Stroke(); } else{ echo "Database is empty"; }?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><br />JpGraph 1</body></html><?php}else{ echo "<br><br><center><font face=\"Georgia, Times New Roman, Times, serif\">Warning: You are trying accessing restricted page.</font></center>"; header("Refresh:2, url='../auth/login_form.html'");}?>[/code] Link to comment https://forums.phpfreaks.com/topic/23289-jpgraph-display-weird-thingssymbols/#findComment-105609 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.