mysql - How to get all values in a certain column with php -


i need print out usernames of members in site list, don't know how it. tried use 'mysqli_fetch_array' function fetch names username column, i've been failing. so, please assist me on how can in efficient way.

this code

$sql = "select username users"; $query = mysqli_query($db_con, $sql); $array = array; while($row = mysqli_fetch_array($query)) {       $array =  row[]; } foreach ($names $array) {      echo $names; } 

also want format output, separating each username " | "

you quite close..

$sql = "select username users"; $query = mysqli_query($db_con, $sql);  while($row = mysqli_fetch_assoc($query)) {     echo $row['username'].'|'; } 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -