8 years ago
9
Topic

Bonjour,

J'ai acheté le pack SQL et je n'arrive pas à obtenir quoi que ce soit malgré avoir lu l'explication ici : https://www.seblod.com/resources/extensions/plug-ins/sql-pack

Dans un formulaire je cherche à retrouver une valeur :

SELECT colonne AS text FROM table WHERE id=8

Rien ne s'affiche jamais dans le champ (la requête fonctionne dans phpMyAdmin)

J'ai essayé les exemples de la notice, mais rien ne s'affiche jamais dans le champ :-(

(et sinon à quoi sert le menu déroulant Requête (seul Libre est accessible ?) et à quoi sert le champ "Regrouper par" ?)

Avez-vous plus d'explications pour ce pack ?

Merci !

Get a VIP membership
4229 Posts
Kadministrator
8 years ago
1
Level 1

try

SELECT colonne FROM table WHERE id=8

Ofcourse you need to replace table name with joomla way to write table names, e g. #__content. 

8 years ago
0
Level 2

SELECT colonne FROM table WHERE id=8

don't work : there are nothing in the field. But work fine with Dynamic Cascade...

4229 Posts
Kadministrator
8 years ago
5
Level 1

Are there mutiple (or 0)  records with id 8 ? You need to put in query that will return just a single result

8 years ago
4
Level 2

Yes, records exist...

4229 Posts
Kadministrator
8 years ago
3
Level 3

In which view (content, form, list..) are you trying to use this field? If this is form you need to add text field and use sql field on it as live value.

8 years ago
2
Level 4

I use in site view, like other fields...

4229 Posts
Kadministrator
8 years ago
1
Level 5

What I meant are Seblod views - in form&content there are Admin form, Site form, Intro and Content tabs. What I'm asking is whether you try to use it in one of the form views (Admin form, Site form) - if answer is yes, then it won't work directly (as a field), you need to use it as live variable.

8 years ago
0
Level 6

Effectively, I try to use in a Site form views... I understand I lose my money with this pack :-( 

I need a field, in a site form view, who can display SQL result  like : SELECT colonne FROM table WHERE id= VALUE OF ANOTHER FIELD

How can I make that with Seblod ?

4229 Posts
Kadministrator
8 years ago
0
Level 1

You can use SQL pack Live plugin to get your initial query with fixed id working (put text field on the form and set live value to sql with your query).

But you can't use value form another field there, for that you need some javascript - a solution is to use select dynamic cascade (with first dropdown having only ids as values and second executing your query) with some additional javascript that can be found at the end of this thread (just adjust ids of your fields):

https://www.seblod.com/community/forums/fields-plug-ins/how-to-use-an-active-field-in-sql-where-clause

Get a VIP membership