5) {
sleep(1);
header("Location:" . $WebSite . "login/login_form.php");
exit;
}
include $_SERVER['DOCUMENT_ROOT'] . '/load_header.php';
// 첫 화면 표시 문구
$title_message = '차량일지 및 월간 사진기록';
?>
=$title_message?>
query("SHOW COLUMNS FROM {$DB}.{$tablename}")->fetchAll(PDO::FETCH_ASSOC);
foreach ($columns as $column) {
$field = $column['Field'];
$type = strtolower($column['Type']);
if (strpos($type, 'char') !== false || strpos($type, 'text') !== false || strpos($type, 'date') !== false) {
$param = ":search_{$field}"; // 유니크한 바인딩 이름
$search_columns[] = "{$field} LIKE {$param}";
$bind_params[$param] = "%{$search}%";
}
}
if (!empty($search_columns)) {
$search_sql = " AND (" . implode(" OR ", $search_columns) . ")";
}
} catch (PDOException $e) {
echo "컬럼 조회 오류: " . $e->getMessage();
exit;
}
}
$sql = $base_sql . $search_sql . " ORDER BY num DESC";
try {
$stmh = $pdo->prepare($sql);
foreach ($bind_params as $param => $value) {
$stmh->bindValue($param, $value, PDO::PARAM_STR); // 1:1로 바인딩
}
$stmh->execute();
$total_row = $stmh->rowCount();
// } catch (PDOException $e) {
// echo "오류: " . $e->getMessage();
// }
// var_dump($sql);
// try{
// $stmh = $pdo->query($sql);
?>