trigger999 Posted March 17, 2015 Share Posted March 17, 2015 HI Guys, Newbie question Can anybody help me with what is wrong with my IF Statement Please: <td>if ($record['docs_available'] = "1"){ echo ".$record['status_name'].";} else {echo ".$record['docs_available'].";} </td thanks in advance Link to comment https://forums.phpfreaks.com/topic/295314-whats-wrong-with-my-if-statement/ Share on other sites More sharing options...
ginerjm Posted March 17, 2015 Share Posted March 17, 2015 Your code is out of context as posted (BESIDES being posted here incorrectly to boot) so it makes it hard to tell you what to change. Show us some more code before this so we may see what mode you are in and what this line should therefore look like. You don't tell us what is making you think it is wrong in the first place. We don't know if you have error checking turned on and are seeing a message or if you don't and are seeing a blank screen or if you are simply 'seeing' the php code on the screen because you are outside of php mode. At first glance the problem here is that you are burying php code inside your html code (bad practice - verrry bad) which is causing it to be not recognized as php. Link to comment https://forums.phpfreaks.com/topic/295314-whats-wrong-with-my-if-statement/#findComment-1508312 Share on other sites More sharing options...
Barand Posted March 17, 2015 Share Posted March 17, 2015 if ($record['docs_available'] = "1") "=" is the assignment operator. "==" is the equality operator Link to comment https://forums.phpfreaks.com/topic/295314-whats-wrong-with-my-if-statement/#findComment-1508317 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.