How can I write this IF condition (at the moment I have error, but I don’t know where)?
$gll_name = ($gll_id != NULL ? $w = $this->gallery_model->gallery_get_one_user($gll_id); $w->name : " ");
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You do not need two variables, also “shorthand ifs” do not allow colons. This should work:
(note that I have added indents for visibility, they do not matter in PHP in this case)
Also consider strict conditions (using
!==instead of!=), as PHP will treat all false-ish values (null,false,0etc.) as being equal (==) toNULL, but onlyNULLis strictly equal (===) toNULL. For a demonstration see: http://ideone.com/8ENsX