-2

and thanks for the people they have help me before. I have a litle error and i have try somethings but dont work,

$rows = ( "SELECT `adminid`, `notes` FROM `admin` WHERE `adminid` = '".$_SESSION['adminid']."' LIMIT 1" );
$result1 = ( "SELECT * FROM `log` ORDER BY `logid` DESC LIMIT 15" );
include( "./templates/".TEMPLATE."/header.php" );

This Line:

echo ( $_SESSION['msg1'],$_SESSION['msg2'] );

there is the problem. I have "," its make me problems,maybe someone can explain me or help me to solve it.

Bobrovsky
  • 13,789
  • 19
  • 80
  • 130
  • You are using too many round brackets. Actually all of them in your three lines of code are not needed. Removing them should make your code more easy to read. – hakre Nov 08 '12 at 19:08
  • Also these *problems* are warnings and errors. You should add the error message to your question so it's more clear what you are concerned and what you ask about. You also might find this helpful: http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php – hakre Nov 08 '12 at 19:12
  • http://php.net/variables ; http://php.net/echo ; http://php.net/expressions – hakre Nov 08 '12 at 19:26

2 Answers2

2

echo $_SESSION['msg1'], $_SESSION['msg2'];

remove the ()

hakre
  • 193,403
  • 52
  • 435
  • 836
itachi
  • 6,323
  • 3
  • 30
  • 40
1

To concatenate in PHP you need to use a period:

echo $_SESSION['msg1'] . $_SESSION['msg2'];

or

echo $_SESSION['msg1'] . ' and ' . $_SESSION['msg2'];

If you want to see all of the session vars to see why something might not be working you could try dumping them with:

var_dump($_SESSION);

That will give you a list of everything in there. Might find your variable has not been set.

rg88
  • 20,742
  • 18
  • 76
  • 110
  • 3
    `echo` supports the `,` to separate expressions. However not within round brackets. Wrong: http://codepad.org/5izqExZa - Right: http://codepad.org/rxl7elel – hakre Nov 08 '12 at 19:10
  • @hakre Not inside parenthesis like he has it. Inside parens the `,` will fail while the `.` will work. *edit... ahh, you amended your comment while I was adding mine. Sorry. – rg88 Nov 08 '12 at 19:16
  • Parenthesis = Forming an expression out of one or many sub-expressions. Comma separates expressions. Expressions itself do not have the comma as a separator in PHP. – hakre Nov 08 '12 at 19:20
  • Thanks people you have me help alot ,this form have solve my problem "echo $_SESSION['msg1'] . ' and ' . $_SESSION['msg2'];". – user1706003 Nov 08 '12 at 20:33