Start New Discussion within our Databases Community

Hallo,

I am trying to fix my mysql search query:

 $data = mysql_query("SELECT * FROM static_content WHERE upper(image) or upper(title) or upper(content) LIKE'%$find%'"); 

Please help me to fix it. Is it correct?

I mean where column image (change to upper case) or column title (change to upper case) or column content (change to upper case) like the data that I input in the search box (the code before it already change it to uppercase).

I read the guide, I still do not understand how to apply it to my query. I guess I just use this one:

 $data = mysql_query("SELECT * FROM static_content WHERE upper(image) LIKE'%$find%' or upper(title) LIKE'%$find%' or upper(content) LIKE'%$find%'"); 

Is that correct?

Is that correct?

Yes.

Apart from that. In most cases comparisons in queries are case-insensitive, so you could probably do without UPPER()

This article has been dead for over six months. Start a new discussion instead.