Paul Burney wrote:

Why not add the TIME_FORMAT calls to the original query rather than
performing all the extra queries?  Is your first select something like the
That's what I'd like to do, but not sure how to do that in this context.

SELECT *,TIME_FORMAT(time_column_1,'%whatever') AS time_column_1 FROM table
Aha!  That's what I was looking for!

If you don't know what all the time columns are, you could do a "SHOW
COLUMNS FROM table" query first, then use PHP to parse the results to tell
you which fields are time types,
Right, that's basically what I've already done. When my class instantiates, it parses the columns and builds an array with the names of the columns that are time types. Currently I'm using that array to cycle through the results and issue TIME_FORMAT calls on all of the results, but what I wanted was to have the TIME_FORMAT in the original call. But I didn't know how to do that without listing all of the columns and also getting the result in the same name as the original. Your code snippet explains just what I wanted. Thank you!


PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to