agentsmith Posted February 11, 2009 Share Posted February 11, 2009 I execute the below code and get a T_IF unexpected on line 2. BUT I WANT IT TO BE EXPECTED I bet its really simple to correct it if ($_SESSION['link'] >0);{ $sess = $_SESSION['link']; } else { $sess = "0"; } Quote Link to comment https://forums.phpfreaks.com/topic/144753-t_if-unexpected/ Share on other sites More sharing options...
JonnoTheDev Posted February 11, 2009 Share Posted February 11, 2009 if ($_SESSION['link'] >0);{ Should be if($_SESSION['link'] > 0) { Remove the ; Quote Link to comment https://forums.phpfreaks.com/topic/144753-t_if-unexpected/#findComment-759553 Share on other sites More sharing options...
andy_b42 Posted February 11, 2009 Share Posted February 11, 2009 if ($_SESSION['link'] >0){ $sess = $_SESSION['link']; }else{ $sess = "0"; } try that... you had a ";" after the if statement Quote Link to comment https://forums.phpfreaks.com/topic/144753-t_if-unexpected/#findComment-759554 Share on other sites More sharing options...
printf Posted February 11, 2009 Share Posted February 11, 2009 if() is a control structure, not a function():, it opens with * { * and closes with * } * remove the semi-colon! Quote Link to comment https://forums.phpfreaks.com/topic/144753-t_if-unexpected/#findComment-759556 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.