Example #1
0
 function searchProduct()
 {
     include_once "products.php";
     $product = new products();
     $txt = $_REQUEST['txt'];
     if (!$product->searchProduct($txt)) {
         echo '{"result":0,"message":"Could not get products"}';
         return;
     }
     $row = $product->fetchArray();
     echo '{"result":1,"products":[';
     while ($row) {
         echo json_encode($row);
         if ($row = $product->fetchArray()) {
             echo ',';
         }
     }
     echo ']}';
 }