Skip to Content Skip to Menu

mysql field cb2

  • Giankomat
  • Giankomat
  • OFFLINE
  • Posts: 56
  • Thanks: 0
  • Karma: -1
  • Add-ons
9 years 7 months ago #260372 by Giankomat
Replied by Giankomat on topic mysql field cb2

An alternative is to edit your query and have the query it self format the <img tag, which would eliminate the need for a 3rd field.


that's a smart solution i didn't see!
but sadly I tried this:
Code:
SELECT id,concat('<img src="',logo,'"/>'),name FROM `#_teams` WHERE `id` = '[cb_team]' AND `Logo` != ''

that concat with an html tag causes a joomla error 1146.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8282
  • Karma: 1443
9 years 7 months ago #260416 by krileon
Replied by krileon on topic mysql field cb2
Your table is missing an _ so it's not finding the table. Try the below.

Code:
SELECT `id`, CONCAT( '<img src="', `logo`, '" />' ), `name` FROM `#__teams` WHERE `id` = '[cb_team]' AND `logo` != ''


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.

  • Giankomat
  • Giankomat
  • OFFLINE
  • Posts: 56
  • Thanks: 0
  • Karma: -1
  • Add-ons
9 years 7 months ago - 9 years 7 months ago #260465 by Giankomat
Replied by Giankomat on topic mysql field cb2
yep i noticed that typo.
I removed
Code:
logo!=''
condition, in this case it makes no sense :)
Code:
SELECT id,concat('<img src="',logo,'"/>') as logo_img,name FROM `#__teams` WHERE `id` = '[cb_team]'

the alias is necessary (I guess)
what you were thinking about the display setting?
I set
-output:single row
-columns:multiple columns
-display:custom
-custom: [column_logo_img]

but in this case obiouvsly we are back to the beginning: a broken image in case there is no logo
Last edit: 9 years 7 months ago by Giankomat.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8282
  • Karma: 1443
9 years 7 months ago #260504 by krileon
Replied by krileon on topic mysql field cb2

what you were thinking about the display setting?

If you're only using 1 column you might as well remove id and name from the select and just output as single column display. So for example you'd have the following query.

Code:
SELECT CONCAT( '<img src="', `logo`, '" />' ) FROM `#__teams` WHERE `id` = '[cb_team]' AND `logo` != ''

but in this case obiouvsly we are back to the beginning: a broken image in case there is no logo

That's because you removed the `logo` != '' in the 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.

Moderators: beatnantkrileon
Powered by Kunena Forum