Database row display

coppo82 28 Jun, 2013
Hi i have a little question

i'm displaing a database table

field : click , impression, state

in where statement i add this code for show only the row with the username

<?php
$user =& JFactory::getUser();
echo " `name` = '{$user->username}' ";
?>


everythings work fine .
my question now is : in the collum state i have value as 1 or 0 is it possible to add a code for example if state = 1 then show ACTIVE else NOT ACTIVE

THANKS
GreyHead 05 Jul, 2013
Hi coppo82,

I'd do this using Custom Code after the DB Record Loader. It will be something like this:
<?php
if ( $form->data['state'] == 1 ) {
  $form->data['state'] = 'ACTIVE;
} else {
  $form->data['state'] = 'NOT ACTIVE';
}
?>

Bob
This topic is locked and no more replies can be posted.