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).

Recommended Answers

All 6 Replies

No, it's not correct. You need LIKE after every column, unless you concatenate them first.

How to concatenate them ? like where ?

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?


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

Thanks. I probably will close this forum.

If anyone can help me with this one would great:

another related thread

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.