首页 > 代码库 > Jpgraph小应用
Jpgraph小应用
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>成绩查询</title> 6 </head> 7 8 <body> 9 <?php10 include(‘conn.php‘);11 $sql = ‘select distinct(km) from tb_grade‘;12 $r = mysql_query($sql);13 14 ?>15 <form action="lx3do.php" method="post">16 请选择要查询成绩的科目:17 <select name="sel">18 <?php19 while($row = mysql_fetch_array($r)){20 echo ‘<option value="http://www.mamicode.com/‘.$row[‘km‘].‘">‘;21 echo $row[‘km‘];22 echo ‘</option>‘;23 }24 ?>25 26 </select>27 <input type="submit" value="http://www.mamicode.com/查询" name="sub"/>28 </form>29 </body>30 </html>
<?phpheader ( "Content-type: text/html; charset=UTF-8" ); require_once ‘Jpgraph/jpgraph.php‘; require_once ‘Jpgraph/jpgraph_bar.php‘; include(‘conn.php‘);$sel =$_POST[‘sel‘];$sql = "select * from tb_grade where km=‘$sel‘";$r = mysql_query($sql);while ($row=mysql_fetch_array($r)) { $data[] = $row[‘xh‘]; $datas[] = $row[‘cj‘];}$graph = new Graph(600, 600); $graph->SetScale("textlin",0,100); $graph->SetShadow(); $graph->img->SetMargin(60, 10, 60, 80); $barplot = new BarPlot($datas); $graph->Add($barplot);$barplot->value->Show();$graph->title->Set(iconv("utf-8","gb2312","数学成绩")); $graph->xaxis->title->Set(iconv("utf-8","gb2312","学号")); $graph->xaxis->SetTickLabels($data);$graph->yaxis->title->Set(iconv("utf-8","gb2312",‘成绩(百分比)‘)); $graph->title->SetFont(FF_SIMSUN, FS_BOLD); $graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD); $graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD); $graph->Stroke(); ?>
1 <?php2 header("content-type:text/html;charset=utf-8");3 $conn = mysql_connect("localhost","root","") or die("连接服务器失败");4 mysql_select_db("db_test8");5 mysql_query("set names utf8");6 ?>
Jpgraph小应用
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。