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 5 days ago #272665 by tjohns92109
Replied by tjohns92109 on topic Query Field for Displaying Link
Additionally, attached is a screenshot of the exact same query (pasted) in phpMyAdmin... (query1.png)
And a screenshot of the query in CB query parameters (query2.png)

Just to reiterate... I AM NOT trying to do a query validation... just using the query field to display a list of results from the DB. Please don't send more instructions on validation... this only concerns the query field type.
Attachments:

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

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
9 years 4 days ago #272681 by nant
Replied by nant on topic Query Field for Displaying Link

tjohns92109 wrote: Additionally, attached is a screenshot of the exact same query (pasted) in phpMyAdmin... (query1.png)
And a screenshot of the query in CB query parameters (query2.png)

Just to reiterate... I AM NOT trying to do a query validation... just using the query field to display a list of results from the DB. Please don't send more instructions on validation... this only concerns the query field type.


Question: is the table in the same database as Joomla?
The following user(s) said Thank You: tjohns92109

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

9 years 4 days ago #272697 by tjohns92109
Replied by tjohns92109 on topic Query Field for Displaying Link
Yes. Same database.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 4 days ago - 9 years 4 days ago #272702 by krileon
Replied by krileon on topic Query Field for Displaying Link
You're selecting multiple rows without setting it to multiple row output. Try the below usage to limit it to a single row.

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

To output multiple rows you'd need to use the following usage.

Query:
Code:
SELECT `cf_pdf_file` FROM `2sc_form8130` WHERE `user_id` = '[user_id]'
Output: Multiple Rows
Row:
Code:
<div>[column_cf_pdf_file]</div>


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: 9 years 4 days ago by krileon.
The following user(s) said Thank You: tjohns92109

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

9 years 4 days ago #272709 by tjohns92109
Replied by tjohns92109 on topic Query Field for Displaying Link
Strange... I copied your query into the query parameter. It worked to return a single row. I compared it character by character to the one that didn't work and don't see the slightest difference (even checked the backticks and single quotes). Maybe a caching issue or there was a hidden character that I copied before.

Anyway, thanks for repeating that query because it does seem to work now.

You are correct in thinking I want to return more than 1 row. I put the div in the row field and it works!!! I was losing faith haha.

Quick additional question... that query returns rows that have the user_id of the profile that the field is on. Is there a way to echo rows from the user that's logged in? Do I need to get and declare that variable (as in $user = JFactory::getUser())? Or is it already available?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 3 days ago #272734 by krileon
Replied by krileon on topic Query Field for Displaying Link

Quick additional question... that query returns rows that have the user_id of the profile that the field is on. Is there a way to echo rows from the user that's logged in? Do I need to get and declare that variable (as in $user = JFactory::getUser())? Or is it already available?

It supports standard substitutions too. So if you want to substitute in their username for example you could do [username]. See the below for substitution usage information.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-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.

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

Moderators: beatnantkrileon
Powered by Kunena Forum