How can i display these results in a HTML table?

Looking to hire a PHP developer for a paid position? Looking for a paid PHP job? Want to post your resume? Let the job hunt begin...

Moderator: General Moderators

Post Reply
sheilaanderson
Forum Newbie
Posts: 2
Joined: Thu Mar 29, 2018 10:32 pm

How can i display these results in a HTML table?

Post 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
User avatar
Christopher
Site Administrator
Posts: 13592
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

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

Post 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.
(#10850)
User avatar
Christopher
Site Administrator
Posts: 13592
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

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

Post 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.
(#10850)
Post Reply