1

I want to query html in mysql i.e. I have record in table say x with info feild value <p>y</p> . How can I query to match if <p>y</p> is present in that table .

select * from x where info="<p>y</p>";

is it only possible with full-text search or is there any other method too.

3
  • What are you mean with full-text search? Is info like "%<p>y</p>%" what you searching for? Commented Jul 20, 2014 at 8:28
  • If that's the whole field value, why doesn't info="<p>y</p>" work for you? Commented Jul 20, 2014 at 8:43
  • info="<p>y</p>" works only using mysql query but when using with php it does not work. Commented Jul 21, 2014 at 9:39

1 Answer 1

1

SELECT * FROM x WHERE info LIKE '%<p>y</p>%'; is the only thing you can do to match such a string. Full-text search indexes work quite differently and are not suitable for the task. But this LIKE statement is very inefficient: it has to scan every matching row.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.