Advertisement
Guest User

Untitled

a guest
Nov 9th, 2020
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. Illuminate/database
  2. $result = DB::table('info_users')
  3.     ->whereRaw('JSON_SEARCH(`roles` ->> ?, "one", ?) IS NOT NULL', [
  4.         '$.example',
  5.         'read',
  6.     ])
  7.     ->get();
  8.  
  9. Ошибка
  10. SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?, "one", ?) IS NOT NULL' at line 1 (SQL: select * from `info_users` where JSON_SEARCH(`roles` ->> $.example, "one", read) IS NOT NULL)
  11.  
  12. Рабочий запрос
  13. select * from `info_users` where JSON_SEARCH(`roles`->>'$.example', "one", 'read') IS NOT NULL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement