简体   繁体   中英

Assistance with MySQL 'LIKE' Statement

Hello all you beautiful people,

To preface my question, we have a database that stores the entire HTML code of a web form (don't ask, I didn't create this) and some of those HTML values are populated from a different table. This table was discovered to have some double quotes ( " ) in them, this is problem because if you have:

<input type="text" value="Hello "John" Smith">

It will break all of the tags below it.

We've gone ahead and fixed this, and I've implemented a solution to catch these from today onward. But now we have an unknown amount of forms that are broken.

So what I am trying to do is run an SQL statement to find all of the instances that this occurred.

Here is what I've got:

SELECT * FROM tableName WHERE data LIKE '%value="%"%"'

But this statement hasn't yielded any results.

Any help would be greatly appreciated!

Thank you,

DM

您的标签可能没有以引号结尾,因此让我们在末尾添加通配符:

SELECT * FROM tableName WHERE data LIKE '%value="%"%"%'

If the value attribute is the last attribute in an element you could check if the value of value if enclosed in double quotes in this way:

SELECT * FROM tableName WHERE data
LIKE '%value="%"_%>'

The condition checks if there is double quote, before attribute value ends meaning incorrect value.

_% means one or more of any character.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2025 STACKOOM.COM