php - How to retrieve data in mysql table column? -


in mysql table, i've table name: mental_illness there's 2 enum row inside :

n , p

it means negative , positive

and here's php code retrieve data table:

  if ($history->getmentalillness())   {     echo html::section(3, _("mental illness : "));     echo html::para(nl2br($history->getmentalillness()));   } 

here's question:

how use if else in above php code this:

if mental illness p, show positive text , if mental illness n show negative text

because code show p , n instead of negative , positive text.

thank you

just do:

if ($history->getmentalillness()) {   echo html::section(3, _("mental illness : "));   if($history->getmentalillness() == 'p'){     $mental_illness = "positive";   }else{     $mental_illness = "negative";   }   echo html::para(nl2br($mental_illness)); } 

one more thing... why need nl2br in case... there no newlines in these 2 strings...


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

http - Safari render HTML as received -