<?php
session_start();
require_once 'dbconfig.php';
require_once 'db_connection.php'; 


if(isset($_POST['product'])){
   $product =  $_POST['product'];

   $productlist = mysqli_query($conn, "SELECT * FROM mobileproducts WHERE itemcode LIKE '$product%' OR proname LIKE '%$product%'");
    $list = "";
   if ($productlist->num_rows > 0) {
    $list .= "<ul>";
      while($row = $productlist->fetch_assoc()) {  
        $prid = $row['prid'];
           // $user_qury_03 = mysqli_query($conn, "SELECT * FROM tbl_stock WHERE prid = '$prid'");
		  ///  $user_res1 = mysqli_fetch_assoc($user_qury_03);
		  //  $sqty = $user_res1['qty']; 

       //   if($user_res1['qty'] < 1){
         //      $list .= "<li style='background:red; color:#fff;' tabindex='0'>".$row['itemcode']." / " .$row['proname']." / OUT OF STOCK</li>";    
        //  }else{
               $list .= "<li onkeydown='if(event.keyCode==13){ addNewProductById(".$row['prid']."); event.preventDefault(); }' onclick='addNewProductById(".$row['prid'].");' tabindex='0'>".$row['itemcode']." / " .$row['proname']."</li>";    
        //  }
            
            
           
        } 
        $list .= "</ul>";
        echo $list;
   }else{
        echo $list;
   }



}




?>