I have the following SQL query which is performed via an AJAX server request on form submission. It checks a form POST variable $product for any associated products in the database limiting the results to 2. I need to be able to uniquely identify each result from the query using PHP and store them in variables as $product1 and $product2, then return these values to the form without page refresh. Why are the PHP SQL query results not automatically assigned a unique key in the associative array? (see image below)
$product = $_POST['product'];
$sql_query3 = "Select tbl_mixed_case.related_product
FROM tbl_mixed_case JOIN tbl_product_info
ON tbl_product_info.id = tbl_mixed_case.prod_code_id
AND tbl_product_info.product + ' ' = '$product' LIMIT 2" ;
$result3 = mysqli_query($dbconfig, $sql_query3);
while ($products = mysqli_fetch_array($result3, MYSQL_ASSOC)) {
print_r(array_values($products));
}