Please enter your customer number
Search for a part number
options(MYSQLI_OPT_CONNECT_TIMEOUT, 4); // Check connection if ($conn->connect_error) { $data = ['stock' => "Connection failed for $id $sku: " . $conn->connect_error]; echo json_encode( $data ); return; } if(!$custid) { $sql = "SELECT ps.item_number as SKU, stk.item_description as Description, FORMAT (stk.available_quantity, 0) as Stock, concat(\"$\", FORMAT (ps.price, 2)) as \"List Price\" FROM microlab_test.v_price_sheets as ps inner join microlab_test.v_item_sites as stk on ps.item_number = stk.item_number WHERE ps.price_sheet_name = \"Microlab T1\""; } else { $sql = "SELECT cp.item_number as SKU, stk.item_description as Description, FORMAT (stk.available_quantity, 0) as Stock, concat(\"$\", FORMAT (cp.price, 2)) as Price FROM microlab_test.v_customer_price_sheets as cp inner join microlab_test.v_item_sites as stk on cp.item_number = stk.item_number WHERE stk.site = \"Microlab/FXR\" AND cp.customer_number = $custid"; } if ($result = $conn->query($sql)) { $skuArray = "var skuArray = ["; $comma = ""; echo ""; echo ""; $fields = $result->fetch_fields(); foreach($fields as $field) { echo ""; } echo ""; foreach ($result as $row) { $arr = array_values($row); $sku = $arr[0]; $desc = $arr[1]; $skuArray .= "$comma{label:\"$sku $desc\", value:\"$sku\"}"; $comma = ","; echo ""; foreach($row as $column) { echo ""; } echo ""; } $skuArray .= "];"; echo "
$field->name
$column
"; $result->free_result(); } $conn->close(); } ?>