-
Notifications
You must be signed in to change notification settings - Fork 2
/
cellinfo1.php
66 lines (50 loc) · 1.75 KB
/
cellinfo1.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
<?php
include_once('Smarty.class.php');
$main_smarty = new Smarty;
include('config.php');
include(mnminclude.'html1.php');
include(mnminclude.'link.php');
include(mnminclude.'tags.php');
include(mnminclude.'user.php');
include_once(mnminclude.'utils.php');
include(mnminclude.'smartyvariables.php');
global $db;
$sidlistquery = "SELECT DISTINCT Sid FROM ".table_prefix."temporary";
$sidlistqueryrs = $db->get_results($sidlistquery);
$sidnum = count($sidlistqueryrs);
echo $sidnum.'<br>';
print_r($sidlistqueryrs);
for($Sid = 1; $Sid<=435; $Sid++){
//for($m = 0; $m < $sidnum; $m++){
// $Sid = $sidlistqueryrs[$m]->Sid;
echo 'Current Sid is '.$Sid.'<br>';
$dnamelistquery = "SELECT DISTINCT Dname FROM ".table_prefix."temporary WHERE Sid = ".$Sid;
$dnamelist = $db->get_results($dnamelistquery);
$num = count($dnamelist);
echo 'Column number is '.$num.'<br>';
//print_r( $dnamelist);
$starttidquery = "SELECT Tid FROM ".table_prefix."temporary WHERE Sid = ".$Sid.' ORDER BY Tid LIMIT 0,1;';
$starttidrs = $db->get_row($starttidquery);
$starttid = $starttidrs->Tid;
echo 'Start Tid is '.$starttid.'<br>';
$endtidquery = "SELECT MAX(Tid) FROM ".table_prefix."temporary WHERE Sid = ".$Sid;
//echo $endtidquery.'<br>';
$endtidrs = $db->get_row($endtidquery);
$endtidarray = (array)$endtidrs;
$endtid = $endtidarray['MAX(Tid)'];
echo 'End Tid is '.$endtid.'<br>';
$totalrow = ($endtid-$starttid+1)/$num;
echo 'Total row is '.$totalrow.'<br><br>';
$i = $starttid-1;
if($i <= $endtid){
for($j = 1; $j <= $totalrow; $j++){
for($k = 1; $k <= $num; $k++){
$i = $i+1;
$updatesql = "UPDATE ".table_prefix."temporary SET rownum = ".$j.", columnnum = ".$k." WHERE Tid = ".$i;
$db->query($updatesql);
//echo $updatesql.'<br>';
}
}
}
}
?>