Invalid request.';
exit;
}
$i_type = mysqli_real_escape_string($jdb->DBConn, $i_type);
// type
$whereType = "";
if (strtoupper($i_type) !== 'ALL') {
$whereType = "AND i.i_type = '{$i_type}'";
}
// status
$statusWhere = "AND i.i_status = 'A'";
if ($showInactive) {
$statusWhere = "AND i.i_status IN ('A','I')";
}
$sql = "
SELECT i.*,
m.m_firstname,
m.m_lastname,
m.m_initial
FROM tbl_customer_image i
LEFT JOIN tbl_member m ON m.m_uid = i.i_createdby
WHERE i.i_customeruid = '{$c_uid}'
{$whereType}
{$statusWhere}
ORDER BY i.i_createddate DESC
";
//
$rlt = mysqli_query($jdb->DBConn, $sql);
if (!$rlt) {
echo '
Query error
';
exit;
}
// 결과 없을 때 체크
if (mysqli_num_rows($rlt) === 0) {
echo 'No images.
';
exit;
}
//
$images = [];
$meta = [];
while ($row = mysqli_fetch_assoc($rlt)) {
$files = explode(',', $row['i_filename']);
foreach ($files as $f) {
$f = trim($f);
if (!$f) continue; // 빈값
$images[] = $row['i_filepath'] . $f;
$meta[] = [
'note' => $row['i_note'] ?? '',
'created' => $row['i_createddate'] ?? '',
'by' => trim(($row['m_firstname'] ?? '').' '.($row['m_lastname'] ?? '')),
'type' => $row['i_type'] ?? ''
];
}
}
$total = count($images);
if ($total === 0) {
echo 'No images.
';
exit;
}
// JSON을 data-attribute로 심기
$imagesJson = htmlspecialchars(json_encode($images), ENT_QUOTES);
$metaJson = htmlspecialchars(json_encode($meta), ENT_QUOTES);
?>
1 / =$total?>
Type: =nl2br(htmlspecialchars($meta[0]['type']))?>
Note: =nl2br(htmlspecialchars($meta[0]['note']))?>
Created: =($meta[0]['created'] ? date('Y-m-d H:i', strtotime($meta[0]['created'])) : '')?>
By: =htmlspecialchars($meta[0]['by'])?>