<?php
include '_common.php';

$searchTerm = $_GET['q'];

// SQL 쿼리 생성
$result = sql_query("SELECT cpu_name, cores, category FROM api___price_cpu_mega WHERE cpu_name LIKE '%{$searchTerm}%' ");

$return_data = array();
while ($row = $result->fetch_assoc()) {
    $return_data[] = $row['cpu_name'].' ('.$row['cores'].' Cores) - '.$row['category'];
}

echo json_encode($return_data);
?>
