Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] Query Field for Displaying Link

9 years 1 week ago - 9 years 2 days ago #272576 by tjohns92109
[SOLVED] Query Field for Displaying Link was created by tjohns92109
I have a form external from CB in which I have it saving the form data to a table in the database. I want to display one field as long as the userid is the same on that record as the current user's userid.

I created a query field and put the following into it:
SELECT cf_pdf_file FROM 2sc_form8130 WHERE user_id = [userid]

However, it doesn't seem to do anything (even if I remove the WHERE clause). Is this the best way to go about this?

The only other way I can think of is to use a custom HTML field with content plugins turned on, create a custom HTML module, and code the PHP to pull and echo the field data. But I was thinking I could do this through Community Builder.
Last edit: 9 years 2 days ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 6 days ago #272623 by krileon
Replied by krileon on topic Query Field for Displaying Link
Your substitution isn't correct for user id. Be sure you always quote substitutions as they could be a int, a string, or null. Please see the below for valid user id substitution usage.

Code:
SELECT `cf_pdf_file` FROM `2sc_form8130` WHERE `user_id` = '[user_id]'

Be sure to enable debug mode and maximum error reporting in Joomla global configuration so errors can output during testing.


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.

9 years 6 days ago - 9 years 6 days ago #272635 by tjohns92109
Replied by tjohns92109 on topic Query Field for Displaying Link
Thanks, Kyle, for the clarification on that. It still didn't work so I put the query into phpMyAdmin, but substituted an actual user id (488) so it looked like:

SELECT `cf_pdf_file` FROM `2sc_form8130` WHERE `user_id` = '488'

And that worked fine. I turned on maximum error reporting & debug. Didn't see any errors. I'll paste the database query that's showing below. Supposedly it's returning 6 rows - but they're not showing. The Query PLugin is published, by the way.


Query Time: 0.35 ms After last query: 0.85 ms Query memory: 0.027 MB Memory before query: 34.535 MB Rows returned: 6
SELECT `cf_pdf_file`
FROM `2sc_form8130`
WHERE `user_id` = '488';
Explain
EXPLAIN not possible on query: SELECT `cf_pdf_file` FROM `2sc_form8130` WHERE `user_id` = '488'
Profile
No SHOW PROFILE (maybe because there are more than 100 queries)
Call Stack
JROOT/libraries/CBLib/CBLib/Database/Driver/CmsDatabaseDriver.php:394
JROOT/components/com_comprofiler/plugin/user/plug_cbqueryfield/cbqueryfield.php:302
JROOT/libraries/CBLib/CB/Legacy/cbFieldHandler.php:92
JROOT/libraries/CBLib/CB/Legacy/cbPluginHandler.php:884
JROOT/libraries/CBLib/CB/Legacy/cbPluginHandler.php:1080
JROOT/libraries/CBLib/CB/Legacy/cbTabs.php:1338
JROOT/libraries/CBLib/CB/Legacy/cbTabs.php:1253
JROOT/libraries/CBLib/CB/Legacy/cbTabs.php:988
JROOT/libraries/CBLib/CB/Legacy/cbTabs.php:314
JROOT/libraries/CBLib/CB/Legacy/cbTabs.php:369
JROOT/libraries/CBLib/CB/Legacy/CBuser.php:385
JROOT/components/com_comprofiler/comprofiler.html.php:280
JROOT/components/com_comprofiler/comprofiler.php:605
JROOT/components/com_comprofiler/comprofiler.php:104
JROOT/libraries/cms/component/helper.php:392
JROOT/libraries/cms/component/helper.php:372
JROOT/libraries/cms/application/site.php:191
JROOT/libraries/cms/application/site.php:230
JROOT/libraries/cms/application/cms.php:252
JROOT/index.php:45
Last edit: 9 years 6 days ago by tjohns92109. Reason: typo

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 5 days ago #272645 by krileon
Replied by krileon on topic Query Field for Displaying Link
Please see the below videos carefully. They show how to setup and use a CB Query Field, Query Validation, etc..

www.youtube.com/playlist?list=PLp0puRITgC7MM9iP9FooKB1qk8f5MLWVp

If your query returns more than 1 result then you need to use multiple rows output or put a LIMIT 1 on your query.


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.

9 years 5 days ago #272663 by tjohns92109
Replied by tjohns92109 on topic Query Field for Displaying Link
I have no idea why you sent me to watch those videos. They're both for query field validation on a text field. Not close to what I'm doing. The first one is titled, "getting started with cb query field and validation", but the only mention of the actual cb query field in the video is how to install the plugin.

This has killed several days of productivity now and I'm going to assume it's a bug since the query runs perfectly in phpMyAdmin. I'll open a ticket.

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

9 years 5 days ago #272664 by tjohns92109
Replied by tjohns92109 on topic Query Field for Displaying Link
Great... I have no access to the support tickets. Your system is trying to make me purchase the membership I'm logged into in order to submit a ticket. Apparently there's a bug in your own system.

So, how do I get support for a bug? Here?

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

Moderators: beatnantkrileon
Powered by Kunena Forum