Skip to Content Skip to Menu

CB conditional error on Query field

  • Buzz50
  • Buzz50
  • OFFLINE
  • Posts: 180
  • Thanks: 10
  • Karma: 2
10 years 3 months ago #246963 by Buzz50
CB conditional error on Query field was created by Buzz50
I have a field which I want to display dependent on the value on another field.

The first field is a delimiter type

The field that it depends on is a query type

The query is:

SELECT FLOOR(points) FROM wxo_alpha_userpoints WHERE wxo_alpha_userpoints.userid = [user_id]

The condition for the second field is:
cb_buzzerpoints > 10000

It works in most case but in some, when accessing certain profile pages I get the error:

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 '[user_id]' at line 1 SQL=SELECT FLOOR(points) FROM wxo_alpha_userpoints WHERE wxo_alpha_userpoints.userid = [user_id]

It seems that the substitution is not working for some profile pages.
In most cases, whether the points total is below or above 10000, the first field shows or not when it should do.

Buzz50
Mike
Buzz50 Seniors
'Head Buzzer'

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8282
  • Karma: 1443
10 years 3 months ago #246997 by krileon
Replied by krileon on topic CB conditional error on Query field
Your query has no escaping. All substitutions are string, but your usage is treating it like an integer. Please try the below query.

Code:
SELECT FLOOR( `points` ) FROM `#__alpha_userpoints` WHERE `userid` = '[user_id]'


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.

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

Moderators: beatnantkrileon
Powered by Kunena Forum