php - Can't echo different from each row -


i attempting echo piece of information database. each row has different value , need able echo each value. having trouble doing so. had got working before get it.

$query = "select itemname,defindex,maxamount,sellprice,buyprice,stock,image,type pricestorage order `itemname` asc"; $result = mysqli_query($con,$query); $resultset = mysqli_fetch_array($result, mysqli_both); foreach ($resultset $id => $row) {     echo $row["itemname"]; } 

i know stupid, have been trying figure out couple of hours , can't.

from docs:

fetch result row associative, numeric array, or both

mysqli_fetch_array fetchs 1 row, should like:

while($row = mysqli_fetch_array($result, mysqli_both)) {   echo $row['itemname']; } 

in way rows fetched in while loop , echoed, can iterate row values foreach if that's want.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -