PHP to change output string from mysql to something else?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jchang
Forum Newbie
Posts: 1
Joined: Wed May 27, 2009 2:11 pm

PHP to change output string from mysql to something else?

Post 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
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

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

Post 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.
Post Reply