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?

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!

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.