I've got this:
'char_transfertime' => $data['TransferTime'],
Which is getting the date from mssql column: TransferTime
for example: 2013-08-19 18:55:00
and displays it on the users profile. But if the TransferTime
is NULL
it will display NULL
on website and I want it to be N/A
How to add something to this above, so If NULL
= N/A
?
Something like this: 'char_clan' => !isset($data['IDName']) ? "N/A" : '<a href="./?page=clan&id=' . $data['Knights'] . '">' . $data['IDName'] . '</a>');
'char_clan' => !isset($data['IDName']) ? "N/A" : '<a href="./?page=clan&id=' . $data['Knights'] . '">' . $data['IDName'] . '</a>');
Here is the syntax:
SELECT Class, Race, Strong, Sta, Dex, Intel, Cha, Points,
isnull(TransferTime,'N/A')TransferTime FROM USERDATA
It must be like this :
'char_transfertime' => isset ( $data['TransferTime'] ) ? $data['TransferTime'] : 'N/A',
Read here about the ternary operator : http://php.net/manual/en/language.operators.comparison.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.