Page 1 of 1

PHP to change output string from mysql to something else?

Posted: Wed May 27, 2009 2:17 pm
by jchang
Hi,
I would like to find out if there is a way for php to replace certain string text that mysql outputs from a query to some other human readable format.
when I run a query, it outputs ef:assignedTask but I would like to simply change it to "Assigned" with PHP.
Can someone point me to a right direction?
Thanks in advance.
Best,
jchang

Re: PHP to change output string from mysql to something else

Posted: Wed May 27, 2009 9:09 pm
by McInfo
Is "ef:assignedTask" a field name? If it is, you can return an alias for a field with this syntax:

Code: Select all

SELECT `ef:assignedTask` AS `Assigned` FROM `table`
You can omit "AS", but the query is more readable with the keyword included.

Code: Select all

SELECT `ef:assignedTask` `Assigned` FROM `table`
Edit: This post was recovered from search engine cache.