Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Jesus Mendoza
Jesus Mendoza
23,288 Points

Does people still use tables?

Does people still use tables to display data from the server? I've seen many websites that use lists and list items to display that data.

3 Answers

kevin jordan
kevin jordan
11,353 Points

Jesus - In my experience it really depends on the type of data that you are going to display. If you have a lot of information that needs many columns, then you're better off using a table. If you only need one or two columns to display the info from your DB, you can get away with lists (LI). The benefits of tables include using thead and tbody to separate out your data and maintain legibility. Also, you will have more control of how the data will look since CSS has many more selectors for tables. Hope this helps ! kj

Jesus Mendoza
Jesus Mendoza
23,288 Points

I saw a job search webpage retrieving data from the server and displaying it in list items with headers and a nice css style, but i've also seen webpages display the data using tables. I didn't know if the webpages using tables were not up to date, so, that's why I asked.

Thanks.

Hi Jesus,

I are referring to simply using a table format to lay out data on a webpage ? Typically using table, th, tr, td elements?

Thanks Craig

Jesus Mendoza
Jesus Mendoza
23,288 Points

I mean when retrieving data from a server with PHP and displaying it on the page! Thanks for your answer.

My knowlege of PHP is limited to what I have learnt on treehouse, I may possibly be misunderstanding the question but to the best of my knowledge PHP is as we know a server side langues and once a request is sent from the browser to the server, the servers turn that php into front end language and serve it to the browser...

I am unsure of where tables come into the php language as php basically serves up html for your css to style(as far as i know but i could be correct on this) Marcus Parsons normally answers lots of my questions on JavaScript he may be able to help more!

Also when doing the course on php I visited this site alot

Hope this is in someway helpful

Thanks for the mention Craig! As far as tables and lists go, it's really up to you how you want to display the data. If it makes sense as a list, make it a list. If it makes sense as a table, make it a table. If you're thinking of using your table as a layout for a website (not an email mind you) then check out this article on why using tables for layouts is a stupid idea.

When it comes to PHP, it does serve back HTML to the page, but it also does quite a bit more. If it just turned the code back into front side language, there would really be no need for it. We could just use JavaScript for that, and it would be faster because the data wouldn't have to be sent off to the server, processed, and then shipped back. One of the things PHP does well is help with handling user input in a secure environment. You wouldn't want to run encryption on the client side using JavaScript (or another client side language) because it would be easy to reverse engineer. After all, since it is being ran on the client side, your computer has access to that data, and that means you'd also be able to reverse engineer everyone else's data. But if you are running an encryption algorithm on the server and then sending only data that the user needs to see, you are making things more efficient for both you and the user.

A great read for what PHP does is from the php.net site that Craig mentioned, in an article aptly called What Can PHP Do?

Maor Tzabari
Maor Tzabari
1,762 Points

It's important to know that CSS was only few years after HTML, Web developers didn't have the chance to deal with float left and right with CSS, or all the new CSS properties that you're learning now. Most of the markup was with tables and not divs, and instead of floating left you would have to create a table with columns.

Now it's more flexible, but it's recommended to have a good understanding for tables, It's 2015 and still you will find yourself building a page without CSS because the device that you building it for - doesn't read CSS. another example is when you creating a newsletter, if you want most of the mobile devices to see it will, you will have to build it with table.

Hope this information was helpful for you