[SOLVED] DBlookup plugin - Query doesn't work

12 years 1 month ago - 12 years 1 month ago #195448 by zandar
I need to check at registration time if a predefined personal code entered by a user in a dblookup-type custom field, named "cb_codiceassistito", does exist in a table named "pazienti".

The query:
SELECT p.codice, p.codusl, p.userid from pazienti p
WHERE p.codusl = '417SC440'
AND p.userid is NULL

does work if executed directly querying the db (i.e. with Navicat) AND if hard-write the code (417SC440) in the field's query definition box.
This is a screenshot from Navicat demonstrating the successful query's execution:



The query fails, popping up the "invalid code" message box, if I feed the query with the very same code value, this time entered by the user in the corresponding field on the registration form (the cb field [cb_codiceassistito])

The definition of the query in the CB field definiton screen is the following:





This is the error showed upon submission:




It seems a syntax error, but I can't pinpoint it.

Could someone help?

Thanks in advance.
Attachments:

Please Log in to join the conversation.

12 years 1 month ago #195523 by nant
Replied by nant on topic Re: DBlookup plugin - Query doesn't work
Please see example in wiki:

forge.joomlapolis.com/projects/cb-cbdblookupfield/wiki

You cannot use cb_codiceas... as it does not exist yet - you need to use [value] instead.

Please Log in to join the conversation.

12 years 1 month ago #195566 by zandar
Replied by zandar on topic Re: DBlookup plugin - Query doesn't work
oops...

I was taking [value] as a placeholder for the actual field name.

I should never forget the KISS (Keep It Simple Stupid :blush:) approach

Thank you very much.

Please Log in to join the conversation.

12 years 1 month ago #195585 by nant

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.220 seconds

Facebook Twitter LinkedIn