Skip to Content Skip to Menu

[SOLVED] DBlookup plugin - Query doesn't work

  • zandar
  • zandar
  • OFFLINE
  • Posts: 7
  • Thanks: 2
  • Karma: 0
12 years 7 months ago - 12 years 6 months 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:
Code:
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:
Last edit: 12 years 6 months ago by krileon.

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

  • nant
  • nant
  • ONLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
12 years 6 months 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 or Create an account to join the conversation.

  • zandar
  • zandar
  • OFFLINE
  • Posts: 7
  • Thanks: 2
  • Karma: 0
12 years 6 months 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 or Create an account to join the conversation.

  • nant
  • nant
  • ONLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
12 years 6 months ago #195585 by nant

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

Moderators: beatnantkrileon
Powered by Kunena Forum