I have a database structure that looks like the following:
I am trying to store the prices as a variables so that if I reference cage_linear_feet it will display 225.
I have tried the following code:
$sql = "SELECT * from pricing WHERE region = '$region' ";
$result = mysqli_query($conn, $sql);
while($rows=mysqli_fetch_assoc($result)){
$test[] = array($rows['field']=>$rows['price']);
}
print_r ($test);
This displays the following:
Array ( [0] => Array ( [cage_linear_feet] => 225 ) [1] => Array ( [cage_doors] => 1800 ) )
How do I access the "225" and "1800" values ensuring that if more records are added to the db it will still pick up the correct records. E.g as the $test1 which is cage_doors may change if records are added.
