Welcome Guest, Not a member yet? Register   Sign In
$query->result() and Mysql TIME_FORMAT queries
#2

[eluser]Hockeychap[/eluser]
The quickest way to get to any function based mysql field (i.e. time_format, date_format etc) is to use an field alias. Have a look http://dev.mysql.com/doc/refman/5.5/en/select.html and search for "A select_expr can be given an alias using AS alias_name" ...

That should help Smile

Basically if you make your query
Code:
SELECT
`hash`,
`title`,
`description`,
`tix_link`,
TIME_FORMAT(`start_time`, '%Y-%m-%d %r') as formattedstart,
TIME_FORMAT(`end_time`, '%Y-%m-%d %r') as formattedend
FROM `events`
WHERE
(`start_time` BETWEEN '$start_low' AND '$start_high')
AND
(`end_time` BETWEEN '$end_low' AND '$end_high')
AND
(`published` = 1)

you can use "formattedstart" and "formattedend" in your array access.

HTH
Justin


Messages In This Thread
$query->result() and Mysql TIME_FORMAT queries - by El Forum - 08-05-2011, 11:47 AM
$query->result() and Mysql TIME_FORMAT queries - by El Forum - 08-05-2011, 03:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB