nQuery($customerQuery, "customer query error"); $firstRow = mysqli_fetch_array($customerResult, MYSQLI_ASSOC); // $c_nameSTR = htmlspecialchars($firstRow['c_name'], ENT_QUOTES); $c_commentSTR = htmlspecialchars($firstRow['c_comment_ri'], ENT_QUOTES); /*----------------------------------- NOTE 데이터 ------------------------------------*/ $notesPerPage = 3; // 전체 개수 조회 $noteCountQuery = " SELECT COUNT(*) AS total FROM tbl_note WHERE n_customeruid = '$c_uid' "; $noteCountResult = $jdb->nQuery($noteCountQuery, "note count error"); $noteCount = mysqli_fetch_array($noteCountResult, MYSQLI_ASSOC)['total']; $totalNotePages = ceil($noteCount / $notesPerPage); if ($note_page < 1) $note_page = 1; $note_start = ($note_page - 1) * $notesPerPage; // NOTE 조회 $noteQuery = " SELECT * FROM tbl_customer tc LEFT OUTER JOIN tbl_note tn ON tc.c_uid = tn.n_customeruid LEFT OUTER JOIN tbl_member tm ON tn.n_memberuid = tm.m_uid WHERE tc.c_uid = '$c_uid' ORDER BY tn.n_createddate DESC LIMIT $note_start, $notesPerPage "; $noteResult = $jdb->nQuery($noteQuery, "note query error"); /*----------------------------------- OIL HISTORY 데이터 ------------------------------------*/ $oilPerPage = 10; // 전체 개수 조회 $oilCountQuery = " SELECT COUNT(*) AS total FROM tbl_daily WHERE d_customeruid = '$c_uid' AND d_status = 'F' "; $oilCountResult = $jdb->nQuery($oilCountQuery, "oil count error"); $oilCount = mysqli_fetch_array($oilCountResult, MYSQLI_ASSOC)['total']; $totalOilPages = ceil($oilCount / $oilPerPage); if ($oil_page < 1) $oil_page = 1; $oil_start = ($oil_page - 1) * $oilPerPage; // 데이터 조회 $oilQuery = " SELECT d_visitdate, d_quantity, m_initial, d_payamount, d_paymenttype, d_paynote, d_paystatus FROM tbl_daily td LEFT OUTER JOIN tbl_request tr ON td.d_ruid = tr.r_uid LEFT OUTER JOIN tbl_member tm ON td.d_driveruid = tm.m_uid WHERE td.d_customeruid = '$c_uid' AND td.d_status = 'F' ORDER BY td.d_visitdate DESC LIMIT $oil_start, $oilPerPage "; $oilResult = $jdb->nQuery($oilQuery, "oil query error"); /*----------------------------------- CO-VISIT 데이터 ------------------------------------*/ $coPerPage = 5; $coCountQuery = " SELECT COUNT(*) AS total FROM tbl_co_visit WHERE cv_customer_uid = '$c_uid' "; $coCountResult = $jdb->nQuery($coCountQuery, "co count error"); $coCount = mysqli_fetch_array($coCountResult, MYSQLI_ASSOC)['total']; $totalCoPages = ceil($coCount / $coPerPage); if ($co_visit_page < 1) $co_visit_page = 1; $co_start = ($co_visit_page - 1) * $coPerPage; $coQuery = " SELECT cv.*, tc.c_name AS co_name, tc.c_accountno AS co_accountno FROM tbl_co_visit cv LEFT JOIN tbl_customer tc ON cv.cv_co_customer_uid = tc.c_uid WHERE cv.cv_customer_uid = '$c_uid' ORDER BY cv.cv_score DESC LIMIT $co_start, $coPerPage "; $coResult = $jdb->nQuery($coQuery, "co query error"); ?>