Vedana Vedana - 2 months ago 7
HTML Question

1 row if statement in PHP

sorry if this question is too simple but I can't figure it out on my own and I could use some help.

Basicly I've got this line of code:

$column_data_ar[] = (string)$employee_ar['functie'].$row = (!empty($row['functie_2']).'<br>'.$employee_ar['functie_2']);


And I want

'<br>'.$employee_ar['functie_2']


only to be posted when the column functie_2 is something else than NULL/Empty.

Thanks ahead for any replies!

Answer

what's with

$row =(!empty($row['functie_2'])) ? '<br>'.$employee_ar['functie_2'] .'</br>' : '';

You could look at this page http://php.net/manual/en/language.operators.comparison.php to learn more about the Ternary Operator.