SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Displaying 2 Variables Side by Side

    This works:

    PHP Code:
    <?php $ChildName $r['DesigGeneral']; ?>
    But I can't put two variables side by side without generating parse/syntax errors:

    PHP Code:
    <?php $ChildName $r['Name'$r['DesigGeneral']; ?>
    I've wrapped both variables in parentheses and brackets, but that didn't help. What I REALLY want to do is include two variables, separated by text, like this:

    PHP Code:
    <?php $ChildName $r['Name']'s State $r['DesigGeneral']; ?>
    It should display something like this...

    Arizona's State Flower

    Thanks for any tips.

  2. #2
    SitePoint Addict
    Join Date
    Jan 2004
    Location
    New York
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $var1 'foo';
    $var2 'bar';
    $var3 $var1.' and '.$var2// 'foo and bar' 

  3. #3
    SitePoint Guru defiance's Avatar
    Join Date
    Oct 2004
    Location
    United states
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $var1 = 'foo';
    $var1 .= 'bar';

    $var1 now contains foobar

    concentation method.

  4. #4
    SitePoint Enthusiast Bobbi's Avatar
    Join Date
    Mar 2005
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, to give you an actual answer:
    PHP Code:
    <?php $ChildName $r['Name'] . "'s State " $r['DesigGeneral']; ?>
    Good luck,

    Bobbi

  5. #5
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perfect - thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •