Using an SQL result in a foreach loop

后端 未结 5 1548
谎友^
谎友^ 2021-01-06 10:36

I feel like I am missing something stupidly obvious here, I am trying to get the results of an SQL query and then using them in a loop. I feel like I am missing something st

5条回答
  •  再見小時候
    2021-01-06 10:52

    Instead of your foreach(), you should do something like this (see the mysql_query() manual page for more):

    while($result = mysql_fetch_assoc($results)) {
        // your code
    }
    

提交回复
热议问题