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
Post a Comment