티스토리 뷰
PHP Source Code
function UpdateDataTables($Conn){
$Query1 = "select * from BDIY_UserInfos";
$queryResult = mysqli_query($Conn, $Query1);
$userList = array();
$index1 = 0;
while($Row1 = mysqli_fetch_array($queryResult)){
$user1 = new cUserInfo();
$user1->SetValuesfromRow($Row1);
$userList[$index1] = $user1;
$index1++;
}
echo "[Count-User] ".$index1."<br>";
foreach($userList as $user1){
$userCode = $user1->UserCode;
$Query1 = "select * from BDIY_DeviceInfos WHERE UserCode='".$userCode."';";
$queryResult = mysqli_query($Conn, $Query1);
$deviceList = array();
$index1 = 0;
while($Row1 = mysqli_fetch_array($queryResult)){
$device1 = new cDeviceInfo();
$device1->SetValuesfromRow($Row1);
$deviceList[$index1] = $device1;
$index1++;
}
echo "[Count-".$userCode."] ".$index1."<br>";
$device1 = $deviceList[0];
$dataTablename = $device1->DataTable;
$Query1 = "select count(*) as cnt from ".$dataTablename.";";
$queryResult = mysqli_query($Conn, $Query1);
while($Row1 = mysqli_fetch_array($queryResult)){
$dataCount = $Row1['cnt'];
echo "[".$dataTablename."] ".$dataCount."<br>";
}
if($dataCount > 3000000){
$newTablename = $userCode."_NewData".date('Ym');
$data1 = new cDataInfo($newTablename);
$data1->CreateTable($Conn);
foreach($deviceList as $device1){
$device1->DataTable = $newTablename;
$device1->UpdateData($Conn);
}
}
}
반응형
'SWDesk > Web' 카테고리의 다른 글
[HTML] 버턴과 텍스트 입력창 구성 및 반응 (0) | 2023.02.24 |
---|---|
[PHP] Data Table from DB (0) | 2023.02.21 |
[Tistory] Uploading Image File (2) | 2021.08.08 |
[PHP] Send Email with Attachment (0) | 2021.07.18 |
[PHP] 데이터를 표로 정리하기 위한 Style (0) | 2021.06.21 |
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Hurdles
- Innovations&Hurdles
- 둎
- badp
- arduino
- 혁신
- 치매방지
- Video
- 절연형
- BSC
- 오블완
- 혁신과허들
- 허들
- DYOV
- Innovation&Hurdles
- Innovations
- 아두이노
- 전압전류모니터링
- 티스토리챌린지
- 전압
- 빌리언트
- 심심풀이
- bilient
- 심심풀이치매방지기
- ServantClock
- 배프
- image
- Decorator
- 전류
- 치매
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함