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"; } 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 ; 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 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! Link to comment https://forums.phpfreaks.com/topic/144753-t_if-unexpected/#findComment-759556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.