JREAM Posted May 12, 2009 Share Posted May 12, 2009 I got a column in a MySQL table that grabs out a number value, like: 1, 2, 3, 4. When I echo it into PHP you get lets say, while (...) { echo $row; } and it will come out as a digit. Is there a way to assign the #'s a value so that, echo $row // if row == 1 change the text to 'favorite'; echo $row // if row == 2 change the text to 'non-favorite'; etc.. Is there a good way to go about such a thing? I dont want it to change the database (because if a global setting changed it needs to stay consistent) Quote Link to comment https://forums.phpfreaks.com/topic/157871-solved-rename-1-to-favorite-only-in-the-output/ Share on other sites More sharing options...
Mchl Posted May 12, 2009 Share Posted May 12, 2009 switch would probably work fine here Quote Link to comment https://forums.phpfreaks.com/topic/157871-solved-rename-1-to-favorite-only-in-the-output/#findComment-832721 Share on other sites More sharing options...
allworknoplay Posted May 12, 2009 Share Posted May 12, 2009 switch would probably work fine here Agreed. Switch is faster than using If conditionals........ Quote Link to comment https://forums.phpfreaks.com/topic/157871-solved-rename-1-to-favorite-only-in-the-output/#findComment-832725 Share on other sites More sharing options...
JREAM Posted May 12, 2009 Author Share Posted May 12, 2009 Cool thanks, yeah the ifs would be cwazy Quote Link to comment https://forums.phpfreaks.com/topic/157871-solved-rename-1-to-favorite-only-in-the-output/#findComment-832741 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.