-2

I have a problem with this line,is there any solution for a line which must contain both single and double quotation marks?

echo "<a href='/ad/.$row['id_ad']'>".$row['title']; 

I get this error:

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)

1 Answers1

0

Exit the "echo" and concatenate with a dot.

echo "<a href='/ad/" . $row['id_ad'] . "'>" . $row['title']; 

That would be the exact match of your line but I believe you forgot to close the anchor.

echo "<a href='/ad/" . $row['id_ad'] . "'>" . $row['title'] . "</a>"; 
Andreas
  • 23,610
  • 6
  • 30
  • 62