<?php
include("connect.php");

if (isset($_POST['value']) && $_POST['value'] != "") {

	$q = $_POST['value'];
    
	$result = mysql_query("SELECT * FROM item WHERE itemName = '".$q."'");
	$row = mysql_fetch_array($result);
	
	$ISBN = $row['ISBN'];
	$price = $row['itemPrice'];
	
	//$arr = array(
    //'z'=>array(
    //    'age'=>33,
    //    'worktime'=>10
    //),
	//);

	$arr = array(
    $q =>array(
        'ISBN'=>$ISBN,
        'price'=>$price,
		'quantity'=>1,
		'bad' =>0
    ),
	);
	
	
    foreach($arr as $k=>$v) {
        
        if ($k == trim($q)) {
            if($v['price']!=0){
            echo $v['ISBN'] . '|'. $v['price'] . '|' . $v['quantity'];
			}else{
			echo $v['ISBN'] . '|'. $v['price'] . '|' . $v['bad'];
			}
        } 
    }
}
?>