-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsqlphpfunctions.php
50 lines (45 loc) · 1.08 KB
/
sqlphpfunctions.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
<?php include 'config.php'; ?>
<?php
function splidtospl($sid){
$query = "SELECT `anyspecialization` FROM `specialization` WHERE `specializationid` = '$sid';";
$results = $GLOBALS['mysqli']->query($query);
if ($results){
while ($obj = $results->fetch_object()) {
$spl = $obj->anyspecialization;
return $spl;
}
}else{
return "Error";
}
}
function spltosplid($spl){
$query = "SELECT `specializationid` FROM `specialization` WHERE `anyspecialization` = '$spl';";
$results = $GLOBALS['mysqli']->query($query);
if ($results){
while ($obj = $results->fetch_object()) {
$spl = $obj->specializationid;
return $spl;
}
}else{
return "Error";
}
}
function allsplidtospl($idlist){
$idli = explode(',', $idlist);
$allspl = '';
foreach ($idli as $id) {
$allspl .= splidtospl($id).',';
}
$tallspl = rtrim($allspl,",");
return $tallspl;
}
function allspltosplid($spllist){
$splli = explode(',', $spllist);
$allid = '';
foreach ($splli as $spl) {
$allid .= spltosplid($spl).',';
}
$tallid = rtrim($allid,",");
return $tallid;
}
?>