php - mysqli_fetch_assoc -


Normally I use mysqli_fetch_array to display the contents of my database in my CMS I used to tell someone recently that I should use the mysqli_fetch_assoc and put the results in an array so that the database runs for each record instead of running the database only once.

But I'm not sure how to display all of my fields without displaying, I usually resonate $ data [field_name '] , but I What I have seen with mysqli_fetch_assoc I can not just echo out $ value ['field_name'] , what I can do is resonate $ value And it displays all the results.

This is what I have done, hope that makes sense Thanks in advance for any help!

PHP

  $ sql = "Select from app selections"; If ($ result = query ($ sql)) {$ list = array (); While ($ data = mysqli_fetch_assoc ($ result)) {array_push ($ list, $ data); } Foreach ($ i => $ list as line $) {foreach ($ column = $ value as value = & gt; $ value) {echo $ value; Why do not you just  
 

code> Echo ['field_name'] per line;

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -