0

in the first php code !$fgmembersite->CheckLogin() works perfectly. also next in the html code <?= $fgmembersite->UserFullName(); ?>! works perfectly. But in the second php it won't work correctly. Am I doing something wrong in that code? if($row['name']=="$fgmembersite->UserFullName()")

<?PHP
require_once("./include/membersite_config.php");

if(!$fgmembersite->CheckLogin())
{
    $fgmembersite->RedirectToURL("login.php");
    exit;
}

?>  

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
      <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
      <title>Home page</title>
      <link rel="STYLESHEET" type="text/css" href="style/fg_membersite.css">
</head>

<body>

<div id='fg_membersite_content'>

<h2>Home Page</h2>

Welcome back <?= $fgmembersite->UserFullName(); ?>!

</div>

</body>

<?php

include("db.php");
$select=mysql_query("select * from commenttable");
while($row=mysql_fetch_array($select))
{
if($row['name']=="$fgmembersite->UserFullName()")
{

        echo "<div id='sty'>";
        echo "<img src='files/fav icon.png'"."' width='50px' height='50px' align='left' />";
        echo "<div id='nameid'>".$row['name']."</div>";
        echo "<div id='msgid'>".$row['message']."</div>";
        echo "</div><br />";

}else{
ob_start();
        echo "<div id='sty'>";
        echo "<img src='files/fav icon.png'"."' width='50px' height='50px' align='left' />";
        echo "<div id='nameid'>".$row['name']."</div>";
        echo "<div id='msgid'>".$row['message']."</div>";
        echo "</div><br />";
ob_end_clean();
}
}

?>
2
  • Please reformat your question properly. See the preview and make sure it displays nicely before posting. Read: meta.stackexchange.com/editing-help Commented Jun 21, 2015 at 14:48
  • Remove the quotes around "$fgmembersite->UserFullName()" Commented Jun 21, 2015 at 14:49

1 Answer 1

1

You have an error with your PHP, you have enclosed what should be PHP code within a string causing it to output as you have typed.

Change the following line:

if($row['name']=="$fgmembersite->UserFullName()")

To the following:

if($row['name']==$fgmembersite->UserFullName())
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.