Jump to content

help with 1 line of code.


justAnoob

Recommended Posts

<?php
echo "".substr($row['description'],0,50),"<span class='style666'><a href='http://xxxxxxxxx.com/viewitem.php'> ...View</a></span>";
?>

Got this to work with no errors, but the style is not applied.

 

.style666 {

color: #0099FF;

text-decoration: none;

}

Link to comment
Share on other sites

There's something weird going on with your two quotes (single or double) at the beginning of the string. This should work:

 

echo substr($row['description'],0,50).'<span class="style666"><a href="http://xxxxxxxxx.com/viewitem.php"> ...View</a></span>';

Link to comment
Share on other sites

I assume you want the double quotes in there? Well they are messing the code up. When you want to output double quotes, you need to use the double quote escape character, which is \". Kinda like the newline character but with quotes instead of n.

<?php
echo "\".substr($row['description'],0,50),\"<a href='http://xxxxxxxx.com/viewitem.php'> ...View</a>";
?>

 

that should fix it

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.