Dsnowdon Posted May 24, 2010 Share Posted May 24, 2010 Hello this is my code i will be using a inclde to include it on my nav bar but dream weaver says there is a syntex error on line six can some one help me with that please. thanks in advance Dale <?php require_once('../auth.php'); require('connet.php') $user_id = $login; $query = "SELECT * FROM `members` WHERE user_id = '$user_id'"; $resultm = mysql_query($query); $user = mysql_fetch_assoc($resultm); ?> <?php echo "Hello {$user['firstname']}:<br /><br />\n"; //Only display link four for users of level 1 if($user['level']=='1') { echo "<a href="#">Link 4</a><br />\n"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/202755-need-help-with-php-if-command/ Share on other sites More sharing options...
awjudd Posted May 24, 2010 Share Posted May 24, 2010 As mentioned on IRC, there are two syntactical errors that you have here. <?php require_once('../auth.php'); require('connet.php'); // Missing semi-colon here (should this be connect.php?) $user_id = $login; $query = "SELECT * FROM `members` WHERE user_id = '$user_id'"; $resultm = mysql_query($query); $user = mysql_fetch_assoc($resultm); ?> <?php echo "Hello {$user['firstname']}:<br /><br />\n"; //Only display link four for users of level 1 if($user['level']=='1') { echo "<a href='#'>Link 4</a><br />\n"; // You used " as both the outside and inside the string ... so you would either have to escape it or swap to single quotes } ?> ~juddster Quote Link to comment https://forums.phpfreaks.com/topic/202755-need-help-with-php-if-command/#findComment-1062675 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.