How do I loop through a PHP array containing data returned from MySQL?

后端 未结 6 1837
野趣味
野趣味 2020-12-21 18:10

Ok I have a table with a few fields. One of the fields is username. There are many times where the username is the same, for example:

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-21 18:22

    I suggest you to read this: http://www.w3schools.com/php/php_mysql_select.asp It will give you an overview idea of how to properly connect to mysql, gather data etc

    For your question, you should use a loop:

    while ($row = mysql_fetch_row($result)){//code}
    

    As said by htw

提交回复
热议问题