Welcome Guest, Not a member yet? Register   Sign In
Processing SQL Results
#3

[eluser]oldmatt[/eluser]
I try to format as much as I can in the Query itself.

For example:

Code:
SELECT
   CONCAT(user_name_first,' ',user_name_last) user,
   TIME_FORMAT(clockin,%l:%i %p) AS clockin,
   IF(active=0,'Inactive','Active') AS status
FROM
   users
WHERE
   user_id = 125;

The above query might return results looking like:

John Smith 1:43 PM Inactive
Mary Jones 12:56 AM Active
Ben Roads 3:12 PM Active

So when the data gets returned the PHP, it is already formatted correctly. That is, if I understood you correctly.


Messages In This Thread
Processing SQL Results - by El Forum - 03-04-2011, 12:12 PM
Processing SQL Results - by El Forum - 03-04-2011, 05:11 PM
Processing SQL Results - by El Forum - 03-04-2011, 09:40 PM
Processing SQL Results - by El Forum - 03-07-2011, 09:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB