<?php
ob_start();
session_start();
error_reporting(E_ALL);
include_once("sistem/database.php");
include_once("sistem/oturum.php");
include_once("sistem/site.php");
$db     = new database();
$ses    = new oturum();
$st		= new site();

$db->baglanti();
$login = $ses->giris();
$info = $st->info();
$results = array();


if (isset($_GET['q'])) {
    $q = mysql_real_escape_string($_GET['q']);
	$q_fix=str_replace(" ","%",$q);
    if ($q_fix) {//
		$dd=mysql_query("SELECT * FROM urunler WHERE isim LIKE '%$q_fix%'");
		if(mysql_num_rows($dd)>0){
            $i=0;
			while($data=mysql_fetch_assoc($dd)){

				$id        = $data['firsatID'];
				$key            = $data['stokKodu'];
				$value      = $data['isim'];
				$results[]  = array('id'=>$id, 'label'=>$value);
			}
		}
    }
}


header('Content-Type: application/jsonp; charset=utf8');
echo json_encode($results);
