php - Array from MYSQLi - can't select specific array result -
following problem:
i need last array (the biggest one) following result print_r:
array ( [1] => 4800 ) array ( [1] => 4800 [2] => 4700 ) array ( [1] => 4800 [2] => 4700 [3] => 4900 ) array ( [1] => 4800 [2] => 4700 [3] => 4900 [4] => 4900 ) array ( [1] => 4800 [2] => 4700 [3] => 4900 [4] => 4900 [5] => 4800 )
but want last one:
array ( [1] => 4800 [2] => 4700 [3] => 4900 [4] => 4900 [5] => 4800 )
mysql/php select code:
while($row = $result->fetch_array()){ $p[$row['idd']] = $row['price']; echo '<br>'; print_r($p); }
i've put explicit answer, though solution trivial because seems you're new this.
while($row = $result->fetch_array()){ $p[$row['idd']] = $row['price']; } print_r($p);
Comments
Post a Comment