LJackson
09-21-2009, 03:50 PM
Hi All
this 'should' be straight forward :)
i am trying to get this to work
print "<div class ='code'><a href="$row['codeLink']">".$row['codeID']."</a></div>";
can someone sort out my mess please?
Thanks
MattF
09-21-2009, 03:52 PM
Don't mix quotes.
print '<div class="code"><a href="'.$row['codeLink'].'">'.$row['codeID'].'</a></div>';
LJackson
09-21-2009, 04:44 PM
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
$shortCode_Desc = rtrim($shortCode_Desc," -");
but its not removing it any ideas
cheers
funnymoney
09-21-2009, 05:53 PM
print "<div class ='code'><a href="$row['codeLink']">".$row['codeID']."</a></div>";
you can do this instead
print "<div class ='code'><a href=\"{$row['codeLink']}\">{$row['codeID']}</a></div>";
and for rtrim, you can use str_replace (http://php.net/str_replace)
// echoes Slalala,lalala
$string = str_replace("-", "", "Slalala,lalala-");
Element
09-21-2009, 06:43 PM
Also you can use
echo <<<HTML
<div class="code"><a href="$row['codeLink']">$row['codeID']</a></div>
HTML;
LJackson
09-21-2009, 07:01 PM
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