Convert code into foreach loop

You do not make the query in the while loop. The while loop comes after the data has been pulled from the table, to iterate through the results.
This is very basic, standard use of sql in php, if you do not know how to do this, you really need to find a course or tutorial on the subject, preferably one using current methods rather than the obsolete mysql.
Though from what became apparent in your previous topic, perhaps you first need to learn html and get a firm basis in that before you even consider using php.

You seem to be mistaking the forums for a “free coding service”. This is a place where you will get help to learn how to code, not a place where people will do your work for you.

6 Likes