I have some data in MySQL table. When user searches for certain keywords, I must search MySQL table for those keywords and provide results to users. When I am providing those results, I want to display few additional columns so that user can get an idea of how data looks like. My requirement is something common in today's webpages - for example in GMail where data is fetched from database and is parsed into multiple columns such as author, subject, date written etc. What is the most efficient way to code such requests. Below were what I could think but felt that they are not very efficient
Fetch each row from MySQL table and construct a HTML/CSS based table with the results. This solution is lacky in sense that there will be multiple requests and responses going between MySQL and webpage
Get each row from database and construct an XML. Pass all this to Javascript and write a javascript code to parse the XML before displaying it as HTML/CSS based table. This again seems lacky in sense that code is once creating XML (through MySQL + PHP) and then parsing it in Javascript
Given these, I would like to know how would a good programmer address the problem of displaying data from MySQL into front end with minimal requests and yet without lot of constructing and parsing information.
Thank you in advance for any suggestions you can offer