0

The result print_f of notification is like this :

Array
(
    [0] => Array
        (
            [notification_id] => 25
            [notification_message] => ada
            [notification_created_date] => 2016-06-30 15:25:32
        )

    [1] => Array
        (
            [notification_id] => 1
            [notification_message] => qwdqdd
            [notification_created_date] => 2016-06-22 15:27:01
        )

)

My view is like this :

<?php
    foreach ($notification as $key => $value) {
?>
        <li>
        <?php
            echo '<a href='.base_url().'notification/notif/'.$value['notification_id'].'>';
        ?>
                <span class="time">
                <?php 
                    echo time_elapsed($value['notification_created_date']); 
                ?>
                </span>
                <span class="details">
                    <span class="label label-sm label-icon label-info">
                        <i class="fa fa-bookmark"></i>
                    </span> <?php echo $value['notification_message']; ?>
                </span>
            </a>
        </li>
<?php
    }
?>

My helper(time_elapsed helper) is like this : http://pastebin.com/AvsHYbxT

The construct in my controller is like this :

public function __construct()
    {
        parent::__construct();

        time_elapsed($created_date=NULL);

        ...
    }

When executed, there is exist error like this :

"NetworkError: 500 Internal Server Error - http://localhost/my-application/dashboard"

When I change echo time_elapsed($value['notification_created_date']); to echo time_elapsed('2016-06-30 15:26:35'); , It's working. No error

So, If notification_created_date is static, no error

If notification_created_date is dynamic, I get an error.

Any solution to solve my problem?

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
moses toh
  • 10,726
  • 57
  • 212
  • 388

0 Answers0