Jump to content

Recommended Posts

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";
}
?>

 

Link to comment
https://forums.phpfreaks.com/topic/202755-need-help-with-php-if-command/
Share on other sites

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.