You can also override the set collation on a field for each comparison. So, for example, if you have a field using the case-sensitive latin1_general_cs collation, but want to compare the fields in a case-insensitive manner, you could do:
SELECT stuff FROM theTable
WHERE textField COLLATE latin1_general_ci = 'John'
Note the end of the collate name. If it's "ci" then it's Case-Insensitive. If it's "cs" then it's Case-Sensitive.
ok. And how to get data from mysql database? In database I want to write many words in one row with commas, like an array. And then I want to fetch it like an array and check if my variable is already exists inside this array. How can I do it?
There are many ways in which you can fetch the tags for each item, depending on how you are using it in your code, but if you wanted to return each item with a comma separated list of tags, MySQL's GROUP_CONCAT function can be used. Like:
> SELECT i.id, i.name, GROUP_CONCAT(t.tag) AS tags
FROM items AS i
JOIN item_tags as t
ON i.id = t.item_id
GROUP BY i.id;
| id | name | tags |
| 1 | Item 1 | tag1,tag2 |
| 2 | Item 2 | tag1,tag3 |
The tags field in that result set could then be exploded in PHP to get them as arrays. Of course, this is not the most efficient way to fetch tags for a single item, but it can be useful if you don't overuse it. (String manipulation is relatively expensive.)