php - Output multiple results with mysqli_fetch_assoc -


what's best way output results select query?

if ($result = mysqli_query($con, "select name,pic_url accounts")) {     $data = mysqli_fetch_assoc($result);     var_dump($data);     mysqli_free_result($result); } 

at present dumping of $data outputs 1 result, though quick check of mysqli_num_rows() shows 2 results (and there 2 rows in table).

what's best way output data?

i'm looking output name field , pic_url each row hoping receive results array can loop through using foreach

you need use loop.

while ($data = mysqli_fetch_assoc($result)) {     var_dump($data); } 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

xcode - Swift Playground - Files are not readable -

jboss7.x - JBoss AS 7.3 vs 7.4 and differences -