mysql - get all values from SQL column using PHP (only returns one value) -


i querying database values in 1 column, putting associative array. db query working, php prints array 1 item.

<?php $acc_names = mysqli_query($con,"select acc_name accounts"); #successfully returns values in column in mysql $acc_names = (mysqli_fetch_assoc($acc_names));  print_r($acc_names);              #only 1 item in array print_r($acc_names['acc_name']);  #that 1 item ?> 

you should use mysqli_fetch_all($acc_names, mysqli_assoc) instead of mysqli_fetch_assoc.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -