-
Notifications
You must be signed in to change notification settings - Fork 0
/
sort.php
58 lines (38 loc) · 975 Bytes
/
sort.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
<?php
require(__DIR__ . '/vendor/autoload.php');
$params = array_merge(
require(__DIR__ . '/config.php')
);
$db = new MysqliDb ($params['db_config']);
$sount = 0;
$i = 0;
$Error = '';
$neworderarray['0'] = "";
$neworderarray= array_merge($neworderarray,$_POST['neworder']);
unset($neworderarray['0']);
//loop through the list of ids and update your db
foreach($neworderarray as $order=>$id){
$data = Array (
'sort' => $order,
);
$db->where ('id', $id);
if ($db->update ('sob', $data))
{ $count++; }
else
{ $Error = $Error.''.$db->getLastError(); }
$i++;
}
if($count!=$i)
{ echo $Error; }
else {
$sob = dbObject::table('sob')->get();
$db->orderBy("sort","asc");
$sob = sob::get();
foreach ($sob as $s) {
$m[]=round($s->kef,2);
}
echo '1-2 :' . round($m['0']*$m['1'],2) .'<br />';
echo '3-4 :' . round($m['2']*$m['3'],2) .'<br />';
echo '1-3 :' . round($m['0']*$m['2'],2) .'<br />';
echo '2-3 :' . round($m['1']*$m['2'],2) .'<br />';
}