Jump to content

help with strange output of echo command


Darkmatter5

Recommended Posts

Here's my code

<?php
    if(isset($_SESSION['member_id'])) {
        echo "You are currently logged in as<strong>" .$ec->current_user().
               "<div class='main_text'>Please register for an account or login for restricted usage.</div><br /><br />";
    } else {
        echo "You are currently not logged in.
                <div class='main_text'></div><br /><br />";
    }
?>

 

Now here's my output:

"Welcome to E-Cabinet! xxx.xxxYou are currently logged in as

Please register for an account or login for restricted usage."

 

It should be:

Welcome to E-Cabinet! You are currently logged in as xxx.xxx

Please register for an account or login for restricted usage."

 

Any ideas?

Link to comment
Share on other sites

I fixed the no </strong> code.

 

Here's current_user()

function current_user() {
   include 'library/config.inc.php';
   require('C:\wamp\www\library\opendb.php');
   $pagedb = "members";

   $member_id = $_SESSION['member_id'];
   $query = mysql_query("SELECT mem_username
                                 FROM " .$dbname. "." .$pagedb.
                                 " WHERE member_id = '" .$member_id. "'
                                 ") or die(mysql_error());
   $current_user = mysql_fetch_array($query);
   echo $current_user['mem_username'];
}

 

Here's the code that shows "Welcome to E-Cabinet"

<div>Welcome to E-Cabinet!
<?php
   if(isset($_SESSION['member_id'])) {
       echo "You are currently logged in as<strong>" .$ec->current_user().
              "</strong><div class='main_text'>Please register for an account or login for restricted usage.</div><br /><br />";
   } else {
       echo "You are currently not logged in.
               <div class='main_text'></div><br /><br />";
   }
?>
</div>

 

Thanks!

Link to comment
Share on other sites

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.