0

I got a syntax error when trying to set an username in my header, handling the exception when no first name and last name is seated, using the username to fill the label, surely is a stupid error. I'm using Quadodo Login Script in my project by the easily implementing.

Here is the code:

if(isset($qls->user_info['firstname'] { 
  $realname = "$qls->user_info['firstname'] . ' ' . $qls->user_info['lastname']"
} else { 
  $realname = "$qls->user_info['username']"
};
cs95
  • 379,657
  • 97
  • 704
  • 746
andreaem
  • 1,635
  • 2
  • 20
  • 49

3 Answers3

1

You have forget semicolon as well as ending bracket in your code.

 // add two ending brackets in below line.
    if(isset($qls->user_info['firstname'])) { 
      // add semicolon in this line
      $realname = "$qls->user_info['firstname'] . ' ' . $qls->user_info['lastname']";
    } else { 
       // add semicolon in this line
      $realname = "$qls->user_info['username']";
    } //removed semicolon
Charlotte Dunois
  • 4,638
  • 2
  • 20
  • 39
Ravi Hirani
  • 6,511
  • 1
  • 27
  • 42
0
if(isset($qls->user_info['firstname'])){ 
  $realname = "$qls->user_info['firstname'] . ' ' . $qls->user_info['lastname']";
} else { 
  $realname = "$qls->user_info['username']";
}

try this

Gagan Upadhyay
  • 255
  • 2
  • 11
0

Well this is because you realy messed up this code. Here is good version:

if(isset($qls->user_info['firstname'])) {
$realname = $qls->user_info['firstname'] . ' ' . $qls->user_info['lastname'];
} else {
$realname = $qls->user_info['username'];
};

I would suggest to use some IDE which will tell you when you have syntax error

Radek Adamiec
  • 502
  • 3
  • 10