-
Notifications
You must be signed in to change notification settings - Fork 1
/
student.php
68 lines (63 loc) · 2.19 KB
/
student.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/**
* @Author: sabuj
* @Date: 2019-12-01 16:00:18
* @Last Modified by: sabuj
* @Last Modified time: 2019-12-06 10:45:04
*/
/**
*
*/
class student{
function __construct(){
}
// Add Student
function addData($name,$fName,$mName,$age,$sem,$email,$phn,$deperment,$setion,$gardiantName,$gardiantPhn){
global $wpdb;
$table_name = $wpdb->prefix . 'AllStudent';
$wpdb->insert( $table_name, ['name' => $name,'fatherName'=>$fName,'motherName' => $mName,'dateDate'=>$age,'semister'=>$sem,'email' => $email,'phone'=>$phn,'department'=>$deperment,'setion'=>$setion,'gardiantName'=>$gardiantName,'gardiantPhn'=> $gardiantPhn
] );
}
// Update Student
function upData($name,$fName,$mName,$age,$sem,$email,$phn,$deperment,$setion,$gardiantName,$gardiantPhn){
global $wpdb;
$data = ['name' => $name,'fatherName'=>$fName,'motherName' => $mName,'dateDate'=>$age,'semister'=>$sem,'email' => $email,'phone'=>$phn,'department'=>$deperment,'setion'=>$setion,'gardiantName'=>$gardiantName,'gardiantPhn'=> $gardiantPhn];
$id = $_GET['id'];
$where = array('id' => $id);
$table_name = $wpdb->prefix . 'AllStudent';
$wpdb->update( $table_name,$data,$where );
}
function add($name,$value,$table){
global $wpdb;
$table_name = $wpdb->prefix . $table;
$wpdb->insert( $table_name, [$name => $value ] );
}
function update($name,$value,$table){
global $wpdb;
$data = [$name=>$value];
$id = $_GET['id'];
$where = array('id' => $id);
$table_name = $wpdb->prefix . $table;
$wpdb->update( $table_name,$data,$where );
} // Delete Data
function deleteData($datatable){
global $wpdb;
$id = $_GET['id'] ?? '';
if ($id) {
$result = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}$datatable WHERE id='{$id}'");
}
$dlt = $_GET['action'] ?? '';
if ($dlt=='delete') {
global $wpdb;
$id = array('id'=> $id);
$table_name = $wpdb->prefix . $datatable;
$wpdb->delete( $table_name,$id );
}
}
function studentFilter($id){
echo $id->name;
echo $id->semister ;
echo $id->department;
echo "</br>";
}
}