Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-21-2009, 03:50 PM   PM User | #1
LJackson
Senior Coder

 
Join Date: Jun 2008
Location: Cornwall
Posts: 1,973
Thanks: 289
Thanked 12 Times in 12 Posts
LJackson is on a distinguished road
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
LJackson is offline   Reply With Quote
Old 09-21-2009, 03:52 PM   PM User | #2
MattF
Senior Coder

 
Join Date: Jul 2009
Location: South Yorkshire, England
Posts: 2,322
Thanks: 6
Thanked 304 Times in 303 Posts
MattF will become famous soon enoughMattF will become famous soon enough
Don't mix quotes.

PHP Code:
print '<div class="code"><a href="'.$row['codeLink'].'">'.$row['codeID'].'</a></div>'
MattF is offline   Reply With Quote
Users who have thanked MattF for this post:
LJackson (09-21-2009)
Old 09-21-2009, 04:44 PM   PM User | #3
LJackson
Senior Coder

 
Join Date: Jun 2008
Location: Cornwall
Posts: 1,973
Thanks: 289
Thanked 12 Times in 12 Posts
LJackson is on a distinguished road
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
LJackson is offline   Reply With Quote
Old 09-21-2009, 05:53 PM   PM User | #4
funnymoney
Regular Coder

 
funnymoney's Avatar
 
Join Date: Aug 2007
Posts: 364
Thanks: 17
Thanked 24 Times in 24 Posts
funnymoney is an unknown quantity at this point
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-"); 
__________________
PHP Idea Factory
funnymoney is offline   Reply With Quote
Old 09-21-2009, 06:43 PM   PM User | #5
Element
Regular Coder

 
Element's Avatar
 
Join Date: Jul 2004
Location: Lynnwood, Washington, US
Posts: 855
Thanks: 2
Thanked 2 Times in 2 Posts
Element is an unknown quantity at this point
Also you can use

PHP Code:
echo <<<HTML
<div class="code"><a href="$row['codeLink']">$row['codeID']</a></div>
HTML; 
Element is offline   Reply With Quote
Old 09-21-2009, 07:01 PM   PM User | #6
LJackson
Senior Coder

 
Join Date: Jun 2008
Location: Cornwall
Posts: 1,973
Thanks: 289
Thanked 12 Times in 12 Posts
LJackson is on a distinguished road
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
LJackson is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:18 PM.


Advertisement
Log in to turn off these ads.