Page 1 of 1

How can i display these results in a HTML table?

Posted: Mon Apr 02, 2018 9:36 pm
by sheilaanderson
hello,

i am trying to figure out how i can display results in a html table

when the customer types in their order number i want to show only certain fields of each row . there will be multiple rows with the same order number?

anybody can give me an idea of what my code should be looking like?

thank you

Re: How can i display these results in a HTML table?

Posted: Tue Apr 03, 2018 12:03 pm
by Christopher
deepvyas wrote:Hello Sheila,
Greetings!
I sent you PM
Please check

Regards
Deep
Please reply to posts in the forum, instead of PM, so all users can get the benefit of your answer. Thanks.

Re: How can i display these results in a HTML table?

Posted: Tue Apr 03, 2018 12:07 pm
by Christopher
sheilaanderson wrote:hello,

i am trying to figure out how i can display results in a html table

when the customer types in their order number i want to show only certain fields of each row . there will be multiple rows with the same order number?

anybody can give me an idea of what my code should be looking like?

thank you
Typically you would loop through the rows of database results and write each line of the table.

Code: Select all

echo "<table>";
echo "<tr><th>ID</th><th>Name</th></tr>";
foreach ($rows as $row) {
    echo "<tr><td>{$row['id']}</td><td>{$row['name']}</td></tr>";
}
echo "</table>";
You could also output JSON from PHP and use Javascript to generate the table.