MySql concat和引号问题

4

我想做类似于这样的事情:

<td>style="background:url('myimage.jpg') no-repeat;"> + column + </td>

但是当我尝试时,出现了MySQL错误:

Concat ('<td>style="background:url('myimage.jpg') no-repeat;">', info_text, '</td') as Nicetext

我想这都是因为引号的原因导致了问题。

感谢您所有的帮助!


请参阅有关转义字符的文章:<br> <a>https://dev59.com/SHNA5IYBdhLWcg3wpfmu</a> - GHC
2个回答

6

您的字符串包含引号。您需要对它们进行转义。尝试使用以下方法:

Concat ('<td>style="background:url(\'myimage.jpg\') no-repeat;">', info_text, '</td') as Nicetext

1

你没有转义引号。试试这个:

Concat ('<td>style="background:url(\'myimage.jpg\') no-repeat;">', info_text, '</td') as Nicetext

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接