I'm working on a MySQL/php project, and I came across the situation where I was getting the results of a query from MySQL and dumping them into a HTML table. Now I am wrapping the cells of a particular column in the table in some anchor tags, and I was just wondering was it better or more efficient to do the wrapping in php or in the MySQL Query itself, e.g.:
...
$row_results_from_query['user'] = '<a href="?user=' . $row_results_from_query['user'] . '">' . $row_results_from_query['user'] . '</a>';
...
OR use the query
SELECT ..., CONCAT("<a href='?user=", Users.user, "'>", Users.user, "</a>") FROM ...
I figured that the php way was faster, however I found some articles which suggested that for some things MySQL is faster.
What is best practice? Why?
Or, is it better to create a stored procedure in MySQL instead?