php學生管理系統
① php在線學生管理系統
我記得淘寶上有賣源碼的,你去看下多少錢
② 學生管理系統php源碼誰有
php學生管理系統源碼,供大家參考,具體內容如下
功能:
1.添加/刪除/修改
2.數據存儲.
界面分布:
index.php
--->主界面
add.php --->stu添加
action ---> sql中add/del/update
(處理html表單-->mysql的數據存儲 && 頁面跳轉)
edit.php --->stu修改
menu.php
-->首頁
1. index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>學生信息管理</title>
<script>
function doDel(id) {
if(confirm('確認刪除?')) {
window.location='action.php?action=del&id='+id;
}
}
</script>
</head>
<body>
<center>
<?php
include ("menu.php");
?>
<h3>瀏覽學生信息</h3>
<table width="500" border="1">
<tr>
<th>ID</th>
<th>姓名</th>
<th>性別</th>
<th>年齡</th>
<th>班級</th>
<th>操作</th>
</tr>
<?php
// 1. 鏈接資料庫
try{
$pdo = new PDO("uri:mysqlPdo.ini","root","1");
}catch (PDOException $e) {
die('connection failed'.$e->getMessage());
}
//2.執行sql
$sql_select = "select * from stu";
//3.data 解析
foreach ( $pdo->query($sql_select) as $row) {
echo "<tr>";
echo "<th>{$row['id']} </th>";
echo "<th>{$row['name']}</th>";
echo "<th>{$row['sex']} </th>";
echo "<th>{$row['age']} </th>";
echo "<th>{$row['classid']}</th>";
echo "<td>
<a href='edit.php?id={$row['id']}'>修改</a>
<a href='javascript:void(0);' onclick='doDel({$row['id']})'>刪除</a>
</td>";
echo "</tr>";
}
?>
</table>
</center>
</body>
</html>
2. add.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>學生管理系統</title>
</head>
<body>
<center>
<?php include ('menu.php'); ?>
<h3>增加學生信息</h3>
<form action="action.php?action=add" method="post">
<table>
<tr>
<td>姓名</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>年齡</td>
<td><input type="text" name="age"></td>
</tr>
<tr>
<td>性別</td>
<td><input type="radio" name="sex" value="男">男</td>
<td><input type="radio" name="sex" value="女">女</td>
</tr>
<tr>
<td>班級</td>
<td><input type="text" name="classid"></td>
</tr>
<tr>
<!-- <td> </td>-->
<td><a href="index.php">返回</td>
<td><input type="submit" value="添加"></td>
<td><input type="reset" value="重置"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
3. action.php
<?php
/**
* Created by PhpStorm.
* User: hyh
* Date: 16-7-7
* Time: 下午9:37
*/
//1. 鏈接資料庫
try{
$pdo = new PDO("uri:mysqlPdo.ini","root","1");
}catch (PDOException $e) {
// echo 'Connection failed: ' . $e->getMessage();
die('connection failed'.$e->getMessage());
}
//2.action 的值做對操作
switch ($_GET['action']){
case 'add'://add
$name = $_POST['name'];
$sex = $_POST['sex'];
$age = $_POST['age'];
$classid = $_POST['classid'];
$sql = "insert into stu (name, sex, age, classid) values ('{$name}', '{$sex}','{$age}','{$classid}')";
$rw = $pdo->exec($sql);
if ($rw > 0){
echo "<script>alter('添加成功');</script>";
}else{
echo "<script>alter('添加失敗');</script>";
}
header('Location: index.php');
break;
case 'del'://get
$id = $_GET['id'];
$sql = "delete from stu where id={$id}";
$rw = $pdo->exec($sql);
if ($rw > 0){
echo "<script>alter('刪除成功');</script>";
}else{
echo "<script>alter('刪除失敗');</script>";
}
header('Location: index.php');
break;
case 'edit'://post
$id = $_POST['id'];
$name = $_POST['name'];
$age = $_POST['age'];
$classid = $_POST['classid'];
$sex = $_POST['sex'];
// echo $id, $age, $age, $name;
$sql = "update stu set name='{$name}', age={$age},sex='{$sex}',classid={$classid} where id={$id};";
// $sql = "update myapp.stu set name='jike',sex='女', age=24,classid=44 where id=17";
print $sql;
$rw = $pdo->exec($sql);
if ($rw > 0){
echo "<script>alter('更新成功');</script>";
}else{
echo "<script>alter('更新失敗');</script>";
}
header('Location: index.php');
break;
default:
header('Location: index.php');
break;
}
4.edit.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>學生管理系統</title>
</head>
<body>
<center>
<?php include ('menu.php');
//1. 鏈接資料庫
try{
$pdo = new PDO("uri:mysqlPdo.ini","root","1");
}catch (PDOException $e) {
die('connection failed'.$e->getMessage());
}
//2.執行sql
$sql_select = "select * from stu where id={$_GET['id']}";
$stmt = $pdo->query($sql_select);
if ($stmt->rowCount() >0) {
$stu = $stmt->fetch(PDO::FETCH_ASSOC); // 解析數據
}else{
die("no have this id:{$_GET['id']}");
}
?>
<h3>修改學生信息</h3>
<form action="action.php?action=edit" method="post">
<input type="hidden" name="id" value="<?php echo $stu['id'];?>">
<table>
<tr>
<td>姓名</td>
<td><input type="text" name="name" value="<?php echo $stu['name'];?>"></td>
</tr>
<tr>
<td>年齡</td>
<td><input type="text" name="age" value="<?php echo $stu['age'];?>"></td>
</tr>
<tr>
<td>性別</td>
<td>
<input type="radio" name="sex" value="男" <?php echo ($stu['sex'] == "男")? "checked":"";?> >男
</td>
<td>
<input type="radio" name="sex" value="女" <?php echo ($stu['sex'] == "女")? "checked":"";?> >女
</td>
</tr>
<tr>
<td>班級</td>
<td><input type="text" name="classid" value="<?php echo $stu['classid']?>"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="更新"></td>
<td><input type="reset" value="重置"></td>
</tr>
</table>
</form>
</center>
<?php
?>
</body>
</html>
5. menu.php
<!DOCTYPE html>
<html lang="en">
<body>
<h2>學生管理系統</h2>
<a href="index.php"> 瀏覽學生</a>
<a href="add.php"> 添加學生</a>
<hr>
</body>
</html>
③ php 學生信息管理系統 修改怎麼寫
都是很簡單的東西,新手用得著、、、
省略部分前端代碼、、、
首先是登錄的校驗:
<?php
session_start();
$user = $_POST['userName'];
$pass = $_POST['passWord'];
$_SESSION['user'] = $user;
/*$Enter = $_POST['Login_undo'];
管理員登錄的校驗*/
$flag = false;
if($user == "Admin"&& $pass == "root")
{
setcookie("userName",$user,time()+1200);
setcookie("userName",$pass,time()+1200);
$flag = true;
header('location:adminPage.php?user=' . $user);
}
else
header('location:Login.php?login=relog');
/*
// 學生登錄免校驗
if($Enter)
header('location:StuPage.php');
*/
然後是注冊的校驗:
<?php
session_start();
$s_ID = $_POST['s_ID'];
$Name = $_POST['Name'];
$IDcard = $_POST['IDcard'];
$Major = $_POST['Major'];
$sex = $_POST['sex'];
$_SESSION['student'][$s_ID]['s_ID'] = $s_ID;
$_SESSION['student'][$s_ID]['Name'] = $Name;
$_SESSION['student'][$s_ID]['IDcard'] = $IDcard;
$_SESSION['student'][$s_ID]['Major'] = $Major;
$_SESSION['student'][$s_ID]['sex'] = $sex;
header('location:tisi.html');
/*foreach($_SESSION['student'] as $v)
{
if($v == $s_ID)
{
header("location:stu_reg.php?action=look&msg=更新&user=employee&empno=" . $empno . "&idcard=" . $idcard);
}
else
header("location:stu_reg.php?action=look&msg=增加&user=employee&empno=" . $empno . "&idcard=" . $idcard);
}*/
畢業操作及加入歷史校驗:
<?php
session_start();
$s_ID=$_GET['s_ID'];
$_SESSION['history'][$s_ID]['s_ID']=$s_ID;
$_SESSION['history'][$s_ID]['Name']=$_SESSION['student'][$s_ID]['Name'];
$_SESSION['history'][$s_ID]['IDcard']=$_SESSION['student'][$s_ID]['IDcard'];
$_SESSION['history'][$s_ID]['sex']=$_SESSION['student'][$s_ID]['sex'];
$_SESSION['history'][$s_ID]['Major']=$_SESSION['student'][$s_ID]['Major'];
unset($_SESSION['student'][$s_ID]);
header('location:graate.php?user=Admin&action=delete');
任意關鍵詞查詢:
<?php
session_start();
$search=$_POST['search'];
unset($_SESSION['search']);
/*echo '<pre>';
var_mp($_POST['search']);
return ;*/
foreach ($_SESSION['student'] as $k1 => $value) {
# code...
if($search==$_SESSION['student'][$k1]['s_ID']||$search==$_SESSION['student'][$k1]['IDcard']||$search==$_SESSION['student'][$k1]['Name']||$search==$_SESSION['student'][$k1]['sex']||$search==$_SESSION['student'][$k1]['Major']){
$i = 1;
$stu = $_SESSION['student'][$k1]['s_ID'];
$_SESSION['search'][$stu] = $stu;
}
}
if(isset($i))
header("location:stu_Query.php?user=Admin&action=search");
else
header("location:stu_Query.php?user=Admin&action=q_error");
遍歷學生信息:
<!DOCTYPE HTML>
<html>
<head>
<link href="file/Style.Css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="1" cellspacing="1" class="css_table" bgcolor='#E1E1E1'>
<?php
session_start();
$user = isset($_SESSION['user'])?$_SESSION['user']:'';
if($user =='Admin'){
if(isset($_SESSION['student'])){
foreach($_SESSION['student'] as $k1) {
echo "<tr>";
foreach($k1 as $k2=>$k3) {
echo "<td>" ;
if($k2=='s_ID') {echo "學號:" ;} else if($k2=='IDcard'){echo "身份證號:";}else if($k2=='sex'){echo "性別:";}else if($k2=='Name'){echo "姓名:";}else if($k2 =='Major'){echo "專業:";};
echo "</td>";
echo "<td>";
if($k2=='s_ID') $s_ID=$k3; echo "$k3";
echo "</td>";
}
}
}
}
?>
</table>
</body>
</html>
更新數據的頁面及校驗:
<!DOCTYPE HTML>
<!-- 使用HTML5規范,省略多餘部分 -->
<html>
<head>
<?php
session_start();
$user = isset($_SESSION['user'])?$_SESSION['user']:'';
$action = isset($_GET['action'])?$_GET['action']:'';
?>
<link href="file/Style.Css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php if($user =='Admin'&&$action==''){ ?>
<table width="100%" border="0" cellpadding="3" cellspacing="1" class="css_table" bgcolor='#E1E1E1'>
<tr class="css_menu">
<td colspan="3">
<table width="100%" border="0" cellpadding="4" cellspacing="0" class="css_main_table">
<tr>
<td class="css_main">注意</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="css_col11"><strong><font color=#50691B>一旦確定不可更改</font></strong></td>
</tr>
<form name = "check_stu" method="post" action="check_stu.php">
<td><lable>請輸入修改學生的學號:
<input name = "c_ID" type="text" >
<input name = "submit" type="submit" value="確定">
</lable></td>
</form>
</table>
<?php }else if ($action == 'change') {?>
<form name="login_f" method="post" action="update_check.php">
<div class = "login" align="center">
<lable>可以修改的項目:</lable>
<input name = "c_ID" type="hidden" value = "<?php echo $_GET['c_ID'];?>">
<li><p>學生姓名:
<input name = "Name" type = "text" id = "Name"></p></li>
<li><p>專業:
<input name = "Major" type = "text" id = "Major"></p></li>
<li>
<p>性別:
<!-- <input name = "sex" type = "text" id = "sex"></p></li> -->
<input type="radio" name="sex" value="男"/>男
<input type="radio" name="sex" value="女"/>女 </br>
</li>
<li><p>確定修改:
<input name = "submit" type = "submit" value = "確定" >
<input class="Renew" value="重寫" type="reset" /> </p></li>
</form>
</div>
<?php }else if ($action == 'enchange') {
# code...
echo "<h1>已經改變</h1>";
}?>
</body>
</html>
<?php
session_start();
$s_ID = $_POST['c_ID'];
$Name = $_POST['Name'];
$Major = $_POST['Major'];
$sex = $_POST['sex'];
$_SESSION['student'][$s_ID]['s_ID'] = $s_ID;
$_SESSION['student'][$s_ID]['Name'] = $Name;
$_SESSION['student'][$s_ID]['Major'] = $Major;
$_SESSION['student'][$s_ID]['sex'] = $sex;
header("location:stu_Update.php?action=enchange");
④ 求指導這個PHP學生管理系統如何連接資料庫使學生管理系統正常運行
1、修改mysql配置文件
vi /etc/my.cnf
[mysqld]段加skip-name-resolve
在這個之前要把mysql的遠程訪問許可權打開,或者再加skip-grant-table(不推薦)
2、修改hosts.allow
vi /etc/hosts.allow
加mysqld : ALL : ALLOW
mysqld-max : ALL :ALLOW
其它網友的補充:
mysql教程 'reading initial communication packet'錯誤解決方法
出現這種問題是伺服器突然關掉出現的問題,
錯誤提示是:
無法鏈接資料庫教程(mysql)伺服器, 請檢查伺服器地址、用戶名、密碼.
代碼: 2013
錯誤: lost connection to mysql server at 'reading initial communication packet', system error: 0
下面我們來看看具體解解決辦法
方法一:解決方法是在 my.cnf 裡面的 [mysqld] 段增加一個啟動參數 skip-name-resolve
方法二:如果你方法一不行,可以嘗試重裝mysql server這樣,再把資料庫導進去就ok了。
總結:
如果能不重裝mysql情況能把機器搞好,那是最好不過了,不在萬不得己請不要重裝mysql哦
⑤ 誰有基於php的學生信息管理系統,發我一份,2531947069
正好有,我發你
⑥ 學生成績管理系統PHP代碼
推薦來你去自www.oschina.net看看,上面有你需要的信息
⑦ 如何用php代碼實現一個學生管理系統包括學生管理課程管理
小夥子 html + CSS jquery js 之類的學的都還可以吧,php 不是一種工具,他是一門語言!版
而且,php 只是相當於框架性質權的,也就是說靠他來實現功能,像你說的 班級管理和教師管理,必須要用html 先布局,把整個網站的基本模塊布置好,然後再創建資料庫和對應的網站後台,而在這個裡面才能體現出php 的作用!懂了哇?你的功能我可以給你分析一下,首先是admin用戶(相當於校長【admin 有所有許可權功能】),其次是教師管理跟班級管理是同等級的,必須相互關聯!藉此你可以做一張教師跟班級的關聯表! 因為一個教教師不可能只有一個班級,而一個班級也不可能只有一個教師!然後教師下面才是班級管理。。。。以此類推,【邏輯才是最重要的!】
⑧ PHP學生管理系統中怎樣實現學生專業的刪除
對於`專業表`和`學生與專業關聯表`進行及聯刪除
⑨ 哪位大神知道免費開源的php+mysql的學生在線考試學習系統和開源的教師管理系統
你可以看下268教育的在線學習系統,是基於php+mysql開發的,但是好像不是免費的,不過你可以先試用一下,你說的在線考試,在線視頻購買,在線資料錄入,學習成績管理,在線支付等功能,在268xue遠程教育系統中都是可以實現的