Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8771181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:43:16+00:00 2026-06-13T17:43:16+00:00

I have the following in my PHP query: SELECT tags.tag, theValues.* FROM ch09.tbl_tags tags

  • 0

I have the following in my PHP query:

SELECT tags.tag, theValues.* 
FROM ch09.tbl_tags tags 
RIGHT JOIN ((SELECT 'dog' as 'Vals')
UNION (SELECT 'cat' as 'Vals')) theValues on tags.tag = theValues.Vals

After the “RIGHT JOIN” everything within the brackets are created on the fly from user input.

It worked fine in MySQL 4, but I just had a new computer and installed 5.5, imported the SQL dump as UTF-8. But I get:

“Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation ‘='”

There’s probably a better way to construct my query, all I need is everything the user inputs in one column as “Vals” and if there’s a matching tag in tbl_tags.tag then it should be there in a column called “tag” else the tag column is blank.

I have tried using Collate: http://www.answermysearches.com/mysql-fixing-illegal-mix-of-collations-message/352/, but I simply cannot get it to work.

So I need to either construct a better query or use the collate function somehow, but how?

Thanks in advance.

Craig

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:43:17+00:00Added an answer on June 13, 2026 at 5:43 pm

    Please see the following question: MySQL Encoding Question

    I think the problem actually deals with the encoding of the Column and SQL text. To get around this, try using the CONVERT(aaa USING bbb) function as follows in your WHERE clause:

    SELECT tags.tag, theValues.* 
      FROM ch09.tbl_tags tags 
     RIGHT JOIN ((SELECT 'dog' as 'Vals')
           UNION (SELECT 'cat' as 'Vals')) theValues
       ON CONVERT(tags.tag USING utf8) = theValues.Vals
    

    Alternatively, change your table’s column encoding to be UTF8.

    Hope this helps,

    john…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query running in PHP: $ticketTotal = mysql_query(SELECT SUM(`tickets_issued`) FROM `tb_att_registered_attendants`
I have the following code: (query added) $weight_table = mysql_query (SELECT * FROM .$prefix.weight
I have the following PHP script : <?php $all_threads=mysql_query(SELECT * FROM forum_threads WHERE category=$_GET[id]);
i have following php file.... mysql_connect(localhost,root,); mysql_select_db(database_name); $sql=mysql_query(select * from members); while($row=mysql_fetch_assoc($sql)) $output[]=$row; print(json_encode($output));
So I have following as part of my query SELECT * FROM $table WHERE
I have the following table and I want to select all (via php query)
I have the following: <?php $result = mysql_query(SELECT `category_id` FROM `categories` WHERE `category_parent_id` =
Imagine I have the following SQL query: SELECT id,name FROM user WHERE id IN
Let say that we have the following query: SELECT DISTINCT COUNT(`users_id`) FROM `users_table`; this
I have the following query: $query = SELECT - AS - FROM - WHERE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.