<?php

require_once('config.php');

$_product = $_POST['product'];
$_group = $_POST['group'];

$extras = array();

$item_extras = odbc_exec($db, "SELECT * FROM Q_ITEMS_DETAYX WHERE receno='$_product' ORDER BY DETAY ASC");

while($item_extra = odbc_fetch_array($item_extras) ) {
  $extras[] = array(
    "name" => $item_extra['DETAY'],
    "price" => $item_extra['FIYAT']
  );
}

$group_extras = odbc_exec($db, "SELECT * FROM Q_ITEMS_ORTAK WHERE ADI='$_group' ORDER BY OZELLIK ASC");

while($group_extra = odbc_fetch_array($group_extras) ) {
  $extras[] = array(
    "name" => $group_extra['OZELLIK'],
    "price" => $group_extra['FIYAT']
  );
}

$response = array("successful" => true, "extras" => $extras);
utf8_print($response);

?>
