COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'utf8' - DB::connection

Viewed 2658

I want to connect inside my laravel to another database to get some data. But I got this error message:

    "SQLSTATE[42000]: Syntax error or access violation: 1253 COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'utf8' (SQL: \nSELECT O.order_id,\n\t   O.order_time,\n\t   from_unixtime(O.order_time)     AS created_at,\n\t   O.priceForPay,\n\t   O.totalPrice,\n\t   O.totalDiscount,\n\t   CONCAT(M.name, ' ', M.family)   AS customer_full_name,\n\t   M.username,\n\t   P.pro_title,\n\t   OP.product_id,\n\t   P.product_identifier            AS namad_code,\n\t   OP.user_quantity                AS count,\n\t   O.mob                           AS mobile,\n\t   CONCAT(AG.name, ' ', AG.family) AS branch_title\nFROM orders_products OP\n\t\t INNER JOIN orders O ON O.order_id = OP.order_id\n\t\t INNER JOIN members M ON M.username = O.user_id\n\t\t LEFT JOIN members AG ON AG.username = O.agent_id\n\t\t INNER JOIN products P ON P.product_id = OP.product_id\nWHERE O.pay_status > 0 and O.order_id = 418766)"

this is my query:

$order = \DB::connection('zarsam_mysql')
                        ->select("
SELECT O.order_id,
       O.order_time,
       from_unixtime(O.order_time)     AS created_at,
       O.priceForPay,
       O.totalPrice,
       O.totalDiscount,
       CONCAT(M.name, ' ', M.family)   AS customer_full_name,
       M.username,
       P.pro_title,
       OP.product_id, .... ");
0 Answers
Related