Jump to content

Changing Output for A Result in PHP


Detomah

Recommended Posts

Hi there, i've had a good look around the forums and on various other sites and can't get my head around a silly little php issue i'm having and was wondering if any of the php guru's on here could possibly provide me with a simple answer/solution please, i've not even been able to get results for what i'm trying to do, as I haven't known the best text to search for this little thing.

 

I'm retrieving data from mysql and one of the cells that I parse the results for always has either a Y or an N for that field.

 

I'm having no issues getting it to display the Y or the N correctly. However...

 

Rather than have it display just an N or a Y, i've been trying to get PHP to make it display either a YES or a NO instead, purely for cosmetic purposes.

 

The php code i've been working with was part of a pre built script I'm currently customising and this bit of functionality never worked in it:

 

<td>" . ($result[7] ? "Yes" : "No") . "</td>

 

$result[7] being the field that contains either a y or a n for every result.

 

Unfortunately, all that my output text does is displays a Yes regardless, even if there is a n in the dbase field.

 

Could someone please help me, so I can get this to display a YES if the field contains a y and display a NO if the field contains a n

 

I know this is probably a bit of a nOObie question, but I am learning this stuff still as I go along...

 

Thanks in advance and sorry for the rather non-technical way i've worded this.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.