Skip to Content Skip to Menu

query field executes only in profile edit mode

  • wowza2
  • wowza2
  • OFFLINE
  • Posts: 86
  • Thanks: 7
  • Karma: 0
10 years 7 months ago #242148 by wowza2
This Query field's query doesn't work for either Profile Edit or View
select 'registerDate' from '#_users' where 'id' = '[user_id]'
not does
select 'registerDate' from 'ove83_users' where 'id' = '[user_id]'

It gets a 1064 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 ''ove83_users' where 'id' = '461'' at line 1 SQL=select 'registerDate' from 'ove83_users' where 'id' = '461'

SELECT registerdate FROM `ove83_users` WHERE id = '461'
works fine in phpMyAdmin

Where am i going wrong please?

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

  • carin
  • carin
  • OFFLINE
  • Posts: 417
  • Thanks: 18
  • Karma: 0
10 years 7 months ago #242149 by carin
try '#__users' instead of '#_users'

CB 2.0
The following user(s) said Thank You: nant

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

  • wowza2
  • wowza2
  • OFFLINE
  • Posts: 86
  • Thanks: 7
  • Karma: 0
10 years 7 months ago #242174 by wowza2
I should have mentioned that I had tried both '#__users' and '#_users' and for the former got 1064 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 ''#__users' where 'id' = '461'' at line 1 SQL=select 'registerDate' from '#__users' where 'id' = '461'"

is there some global switch to allow the #__tablename syntax?

Also still need to get the original problem solved, i.e., getting registerDate from the Joomla users table

thanks

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8281
  • Karma: 1443
10 years 7 months ago - 10 years 7 months ago #242177 by krileon
Your query will never work due to incorrect quote usage. Please see the below working query.

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

Review carefully that tables/columns are escaped with ` and raw values escaped with '.

I however am unsure the reason for such a query though as CB already has a core field that displays registration date.


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.
Last edit: 10 years 7 months ago by krileon.
The following user(s) said Thank You: wowza2

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

  • wowza2
  • wowza2
  • OFFLINE
  • Posts: 86
  • Thanks: 7
  • Karma: 0
10 years 7 months ago #242184 by wowza2
Thank you very much for your, as always, very prompt and helpful reply. We had missed the ` vs. ' distinction (due to poor eyes :silly: )

I assume you were referring to cbactivation as the core field that displays registration date? I have converted users from another system andI need to keep their original date joined from that system, so we are setting the Joomla registerDate field when we load the users. I assummed that cbactivation would be set to the first time the user logged into CB and would overlay the date we set. thanks again.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8281
  • Karma: 1443
10 years 7 months ago - 10 years 7 months ago #242186 by krileon
cbactivation is the users confirmation code. That's generated by CB during registration. registerDate is stored to the Joomla user when the user registers and is displayed via the registerDate field within CB > Field Management. If you want to update it from another system it's better to just do a mass database query to update the users dates to be the same as your previous system and then you're fine from then on. You could also use CB Juice and a well formatted CSV file to import your users into CB.


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.
Last edit: 10 years 7 months ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum