kyleldi Posted March 6, 2009 Share Posted March 6, 2009 I've got a basic if statement that keeps giving me an unexpected $end error when I try to execute it. Any idea what I'm missing? Here's my code: <?php if ($row_rs_staff['title']=="N/A") { echo ''; } else { echo '<p>Department Title: ' . ucwords($row_rs_staff['title']) .'</p>'; } if ($row_rs_staff['extension']=="N/A") { echo '<p>Phone: 616.892.7070</p>'; } else { echo '<p>Phone: 616.892.7070 Ext. ' . ucwords($row_rs_staff['extension']) .'</p><p>Fax: 616.892.7072</p>'; if ($row_rs_staff['email']=="N/A") { echo ''; } else { echo '<p>E-Mail: ' . ucwords($row_rs_staff['extension']) .'</p>'; }?> Link to comment https://forums.phpfreaks.com/topic/148229-solved-if-statement-problem/ Share on other sites More sharing options...
kickstart Posted March 6, 2009 Share Posted March 6, 2009 Hi You are missing a curly bracket to close the code after the line echo '<p>Phone: 616.892.7070 Ext. ' . ucwords($row_rs_staff['extension']) .'</p><p>Fax: 616.892.7072</p>'; All the best Keith Link to comment https://forums.phpfreaks.com/topic/148229-solved-if-statement-problem/#findComment-778152 Share on other sites More sharing options...
jackpf Posted March 6, 2009 Share Posted March 6, 2009 Uhh...is there any reason why your php end tag is on the same line as a } ? I don't know if this has any effect on the script, but you can try putting it on a new line. I would normally test it out myself, but I'm at school (obviously no PHP/Apache) Link to comment https://forums.phpfreaks.com/topic/148229-solved-if-statement-problem/#findComment-778153 Share on other sites More sharing options...
jackpf Posted March 6, 2009 Share Posted March 6, 2009 Hi You are missing a curly bracket to close the code after the line echo '<p>Phone: 616.892.7070 Ext. ' . ucwords($row_rs_staff['extension']) .'</p><p>Fax: 616.892.7072</p>'; All the best Keith ...yeah, and that aswell Link to comment https://forums.phpfreaks.com/topic/148229-solved-if-statement-problem/#findComment-778154 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.