Welcome Guest, Not a member yet? Register   Sign In
NULL check problem/question
#1

[eluser]Unknown[/eluser]
Hi,

I have a question, I'm probably missing something obvious, but wanted to ask for help:

I have this line of code in my controller:

Code:
$data['category'] = null;

I am passing this into my view like follows:

Code:
$this->load->view('catalogue_view', $data);

In my view file (catalogue_view.php), I have the following line:

Code:
<?php if (is_null($category)): ?>

My problem is, my if statement is evaluating to false, even though I know it has been set to false.

What am I missing here?

Thanks,
C.
#2

[eluser]thinkigniter[/eluser]
Try
Code:
<?php (is_null($category))? echo 'nothing here' : echo $category  ; ?>




Theme © iAndrew 2016 - Forum software by © MyBB