|
|
|
รบกวนผู้รู้ครับ PHP..จะให้นำเสนอในรูปแบบของกราฟ ต้องทำไงครับ แก้ยังไง |
|
|
|
|
|
|
|
Code (PHP)
<?php require_once('Connections/newphp.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_newphp, $newphp);
$query_rssr = "SELECT * FROM students";
$rssr = mysql_query($query_rssr, $newphp) or die(mysql_error());
$row_rssr = mysql_fetch_assoc($rssr);
$totalRows_rssr = mysql_num_rows($rssr);
mysql_select_db($database_newphp, $newphp);
$query_rsjob_s_d = "SELECT * FROM students WHERE job_start = 'ได้งานทำแล้ว'";
$rsjob_s_d = mysql_query($query_rsjob_s_d, $newphp) or die(mysql_error());
$row_rsjob_s_d = mysql_fetch_assoc($rsjob_s_d);
$totalRows_rsjob_s_d = mysql_num_rows($rsjob_s_d);
mysql_select_db($database_newphp, $newphp);
$query_rsjob_s_t = "SELECT * FROM students WHERE test = 'Yes'";
$rsjob_s_t = mysql_query($query_rsjob_s_t, $newphp) or die(mysql_error());
$row_rsjob_s_t = mysql_fetch_assoc($rsjob_s_t);
$totalRows_rsjob_s_t = mysql_num_rows($rsjob_s_t);
mysql_select_db($database_newphp, $newphp);
$query_rsjob_s_no = "SELECT * FROM students WHERE test = 'No'";
$rsjob_s_no = mysql_query($query_rsjob_s_no, $newphp) or die(mysql_error());
$row_rsjob_s_no = mysql_fetch_assoc($rsjob_s_no);
$totalRows_rsjob_s_no = mysql_num_rows($rsjob_s_no);
mysql_select_db($database_newphp, $newphp);
$query_rsjob_s_m = "SELECT * FROM students WHERE job_start = 'ยังไม่ได้งานทำ'";
$rsjob_s_m = mysql_query($query_rsjob_s_m, $newphp) or die(mysql_error());
$row_rsjob_s_m = mysql_fetch_assoc($rsjob_s_m);
$totalRows_rsjob_s_m = mysql_num_rows($rsjob_s_m);
mysql_select_db($database_newphp, $newphp);
$query_rsjob_s_ck = "SELECT * FROM students WHERE job_wut = 'ใช่'";
$rsjob_s_ck = mysql_query($query_rsjob_s_ck, $newphp) or die(mysql_error());
$row_rsjob_s_ck = mysql_fetch_assoc($rsjob_s_ck);
$totalRows_rsjob_s_ck = mysql_num_rows($rsjob_s_ck);
mysql_select_db($database_newphp, $newphp);
$query_rsjob_s_nck = "SELECT * FROM students WHERE job_wut = 'ไม่ใช'";
$rsjob_s_nck = mysql_query($query_rsjob_s_nck, $newphp) or die(mysql_error());
$row_rsjob_s_nck = mysql_fetch_assoc($rsjob_s_nck);
$totalRows_rsjob_s_nck = mysql_num_rows($rsjob_s_nck);
$maxRows_rsho = 10;
$pageNum_rsho = 0;
if (isset($_GET['pageNum_rsho'])) {
$pageNum_rsho = $_GET['pageNum_rsho'];
}
$startRow_rsho = $pageNum_rsho * $maxRows_rsho;
mysql_select_db($database_newphp, $newphp);
$query_rsho = "SELECT * FROM students ORDER BY username ASC";
$query_limit_rsho = sprintf("%s LIMIT %d, %d", $query_rsho, $startRow_rsho, $maxRows_rsho);
setthai();
$rsho = mysql_query($query_limit_rsho, $newphp) or die(mysql_error());
$row_rsho = mysql_fetch_assoc($rsho);
if (isset($_GET['totalRows_rsho'])) {
$totalRows_rsho = $_GET['totalRows_rsho'];
} else {
$all_rsho = mysql_query($query_rsho);
$totalRows_rsho = mysql_num_rows($all_rsho);
}
$totalPages_rsho = ceil($totalRows_rsho/$maxRows_rsho)-1;
function setthai(){
mysql_query("SET character_set_results=utf8");
mysql_query("SET collation_connection=utf8_general_ci");
mysql_query("SET NAMES 'utf8'");
}?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ระบบสารสนเทศบัณฑิต ภาควิชาประเมินผลและวิจัยทางการศึกษา</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
<!--
.style39 {font-size: 16}
.style41 {font-size: 14px}
.style42 {color: #0033FF; }
.style43 {color: #003399}
.style47 {
color: #71BBD6
}
.style53 {color: #009966}
.style63 {font-size: 1.2em}
.style66 {color: #006699}
.style68 {font-size: 14px; color: #0033CC; }
-->
</style>
</head>
<body>
<div class="style39" id="container">
<div id="left">
<p> </p>
<p> </p>
<p><br />
<br />
<br />
<br />
<br />
</p>
<h4 align="center" class="style66">เมนู</h4>
<div id="navcontainer">
<ul id="navlist">
<li id="active"><a href="index.php" class="style43" id="current">หน้าหลัก</a></li>
<li class="green"><a href="stu_login.php" class="style42"></a></li>
<li><a href="stu_user_s_id.php" class="style42">ค้นหาศิษย์เก่าบัณฑิต</a></li>
<li><a href="stu_user_bandit.php" class="style42"><span class="quote"></a></li>
<li><a href="stu_user_report.php" class="style42">รายงายข้อมูล</a></li>
<li><a href="admin_login.php" class="style42">ผู้ดูแลระบบ</a></li>
<li><br />
</li>
<li></li>
</ul>
</div>
<h4 align="center" class="style66">บัณฑิตเข้าสู่ระบบ</h4>
<form id="frmadmin" method="post" class="contact_us" action="<?php echo $loginFormAction; ?>">
<p>
<label>Username
<input type="text" class="fields_contact_us" name="textfield" />
</label>
<label>Password
<input type="password" class="fields_contact_us" name="textfield2" />
</label>
<label></label>
<label></label>
<input type="submit" class="submit_button_contact" name="Submit3" value="Submit" />
</p>
</form>
<h4 align="center" class="style66"> </h4>
<p align="center"> </p>
<p align="center"> </p>
</div>
<div id="right">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> <span class="style53"><br />
<marquee>
<span class="style41">
</marquee>
</span>
<marquee>
<br />
<br />
</marquee>
</p>
<blockquote>
<p align="center" class="quote">รายงานข้อมูลศิษย์เก่าบัณฑิต<br />
</p>
<form id="form1" method="post" action="">
<table width="556" border="1" bordercolor="#F4F7F0">
<tr>
<td width="331"><div align="right"><a href="stu_user_r_n.php" target="_blank">จำนวนศิษย์เก่าบัณฑิตที่ได้งานทำแล้วทั้งหมด</a></div></td>
<td colspan="3"> <span class="style68"><?php echo $totalRows_rsjob_s_d ?> </span> คน</td>
</tr>
<tr>
<td><div align="right"><a href="stu_user_r_non.php" target="_blank">จำนวนจำนวนศิษย์เก่าบัณฑิต<strong>ยังไม่ได้งานทำ</strong>ทั้งหมด</a></div></td>
<td colspan="3"> <span class="style68"><?php echo $totalRows_rsjob_s_m ?> </span> คน</td>
</tr>
<tr>
<td> </td>
<td colspan="3"> </td>
</tr>
<tr>
<td><div align="right"><a href="stu_user_r_ts.php" target="_blank">จำนวนจำนวนศิษย์เก่าบัณฑิตที่ทำงานตรงตามสาขาทั้งหมด</a></div></td>
<td colspan="3"> <span class="style68"><?php echo $totalRows_rsjob_s_ck ?></span> คน</td>
</tr>
<tr>
<td><div align="right"><a href="stu_user_r_nts.php" target="_blank">จำนวนจำนวนศิษย์เก่าบัณฑิตที่ทำงาน<strong>ไม่ตรง</strong>ตามสาขาทั้งหมด</a></div></td>
<td colspan="3"> <span class="style68"><?php echo $totalRows_rsjob_s_nck ?></span> คน</td>
</tr>
<tr>
<td colspan="4"><div align="center" class="style66">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </div></td>
</tr>
<tr>
<td> </td>
<td colspan="3"> </td>
</tr>
<tr>
<td height="30"><div align="right">
<div align="right">จำนวนศิษย์เก่าบัณฑิตที่ลงทะเบียนทั้งหมด</div>
</div></td>
<td colspan="3"> <span class="style41"><?php echo $totalRows_rssr ?> </span> คน</td>
</tr>
<tr>
<td height="26"><div align="right">จำนวนศิษย์เก่าบัณฑิตที่ได้กรอกข้อมูลแล้ว</div></td>
<td> </td>
<td colspan="2"><?php echo $totalRows_rsjob_s_t ?> คน</td>
</tr>
<tr>
<td><div align="right">จำนวนศิษย์เก่าบัณฑิตที่ยังไม้ได้กรอกข้อมูล</div></td>
<td> </td>
<td colspan="2"><?php echo $totalRows_rsjob_s_no ?> คน</td>
</tr>
<tr>
<td><div align="right">
<div align="right"></div>
</div></td>
<td width="16"> </td>
<td width="88"> </td>
<td width="93"> </td>
</tr>
</table>
</form>
</blockquote>
<p> </p>
</div>
<div id="footer">Created by: Nacharito 16</div>
</div>
</body>
</html>
<?php
mysql_free_result($rssr);
mysql_free_result($rsjob_s_d);
mysql_free_result($rsjob_s_m);
mysql_free_result($rsjob_s_ck);
mysql_free_result($rsjob_s_nck);
?>
จะให้นำเสนอในรูปแบบของกราฟ
ต้องทำไงครับ
แก้ยังไง
Tag : PHP
|
|
|
|
|
|
Date :
2011-10-23 17:22:49 |
By :
alsobrun |
View :
802 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|