Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,093
    Thanks
    297
    Thanked 12 Times in 12 Posts

    Exclamation printing help please lots of 's and "s?

    Hi All

    this 'should' be straight forward

    i am trying to get this to work
    PHP Code:
    print "<div class ='code'><a href="$row['codeLink']">".$row['codeID']."</a></div>"
    can someone sort out my mess please?

    Thanks

  • #2
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Don't mix quotes.

    PHP Code:
    print '<div class="code"><a href="'.$row['codeLink'].'">'.$row['codeID'].'</a></div>'

  • Users who have thanked MattF for this post:

    LJackson (09-21-2009)

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,093
    Thanks
    297
    Thanked 12 Times in 12 Posts
    thanks mate works a treat

    dont suppose you know why this isnt working

    im trying to remove " -" from the end of a string ive tried this
    PHP Code:
    $shortCode_Desc rtrim($shortCode_Desc," -"); 
    but its not removing it any ideas

    cheers

  • #4
    Regular Coder funnymoney's Avatar
    Join Date
    Aug 2007
    Posts
    364
    Thanks
    17
    Thanked 24 Times in 24 Posts
    PHP Code:
    print "<div class ='code'><a href="$row['codeLink']">".$row['codeID']."</a></div>"
    you can do this instead

    PHP Code:
    print "<div class ='code'><a href=\"{$row['codeLink']}\">{$row['codeID']}</a></div>"
    and for rtrim, you can use str_replace


    PHP Code:
    // echoes Slalala,lalala
    $string str_replace("-""""Slalala,lalala-"); 

  • #5
    Regular Coder Element's Avatar
    Join Date
    Jul 2004
    Location
    Lynnwood, Washington, US
    Posts
    855
    Thanks
    2
    Thanked 2 Times in 2 Posts
    Also you can use

    PHP Code:
    echo <<<HTML
    <div class="code"><a href="$row['codeLink']">$row['codeID']</a></div>
    HTML; 

  • #6
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,093
    Thanks
    297
    Thanked 12 Times in 12 Posts
    thanks mate, unfortunatly string replace would of worked because there were other instances of "-" in the string and it was only the end one i wanted removing, i have solved this but changing my existing preg_replace statment.

    its now working fine

    thanks
    Luke


  •  

    Posting Permissions

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