Using while loop to display contents of a table. Read "Differences between a while loop and a for loop in PHP… I am using a while loop to attempt to extract data from two columns in all of the rows of the table. You need some manual to see how to deal with loops in PHP. foreach and while you will need more often than for. Note: In a do...while loop the condition is tested AFTER executing the statements within the loop. I have a question regarding using a while loop to display the contents of a table. adamschroeder. 3. Okay, here is complete code: