Jump to content

Need help with php if command


Dsnowdon

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.