php - mysqli_fetch_array picking only a single value from a SELECT query -


this question has answer here:

i'm learning php , mysql , have question.

<?php require('../connect_db.php');  $q='select price towels color = "red"'; $r=mysqli_query($dbc, $q);  while($row=mysqli_fetch_array($r, mysqli_num)) {$var=$row[0];}  

in case, have towels different prices have color="red". seems output in $var 1 of prices.

it doesn't seem largest or smallest price, or price belonging first primarykey in table, or else seem intuitive.

so going on here?

thanks.

for ordering need add following end:

order price asc 

you iterating throught results in while. every iteration $var gets price of next element. depending on want prices can list of them in seperate array. didnt discribe want can't that. if edit can continue further on helping


Comments