Skip to Content Skip to Menu

[SOLVED] CB QUERY field problem.

  • scalla
  • scalla
  • OFFLINE
  • Posts: 4
  • Thanks: 2
  • Karma: 0
6 years 3 weeks ago - 6 years 2 weeks ago #307717 by scalla
[SOLVED] CB QUERY field problem. was created by scalla
I encountered problem with custom cb query field. When this field is published, users can't perform new registration, even there is not possible to add new user from backend (Community Builder/User Management/Add New user). The action ends with error: '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 '[USER_ID]' at line 8'

Can you retest my query field setting, please?
Title: Email Address
Name: cb_email
Type: Query
Required: Not Required
Query: select email from `#__users` where id = [USER_ID]

Existing users login isn't affected. Within user profile field works properly and display users email adress.

Thanks

Tomas
Last edit: 6 years 2 weeks ago by krileon. Reason: Added [SOLVED] tag to subject

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8277
  • Karma: 1443
6 years 3 weeks ago #307740 by krileon
Replied by krileon on topic CB QUERY field problem.
It's because your SQL is causing a fatal error. Treat all substitutions as strings. Do not expect them to always provide an integer for example. Your query should be as follows.

Code:
SELECT `email` FROM `#__users` WHERE `id` = '[user_id]'

I'm not sure why you're doing such a query though. You can display the users email using the email address field or substituting


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: scalla

Please Log in or Create an account to join the conversation.

  • scalla
  • scalla
  • OFFLINE
  • Posts: 4
  • Thanks: 2
  • Karma: 0
6 years 3 weeks ago #307754 by scalla
Replied by scalla on topic CB QUERY field problem.
Krileon, thanks for you advice. I didn't expect problem in the query statement, because this field wasn't updated two years and all the time worked properly. It solved my problem.
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum