6 years ago
1
Topic

I am new to Seblod and still don't quite understand the proper way to access fields as variables from tables, vs. forms.  

At the moment I am trying to set a query in Select Dynamic field

SELECT field_for_display AS 'text', field_for_value AS 'value' FROM table WHERE table_user_location_code = '#$user->user_location_code#' 

The user_location_code field used in the where clause is from the table #_cck_store_item_users. Does this still work with the $user->

Thank you in advance for correcting my problem.

Get a VIP membership
1283 Posts
Bucklash
6 years ago
0
Level 1

Hi

Just rewriting your query in a way that works for me ...

SELECT field_for_display AS text, field_for_value AS value 
FROM table 
WHERE table_user_location_code = $user->user_location_code

REAL EXAMPLE
SELECT name AS text, id AS value 
FROM #__users 
WHERE id = $user->id

from there can check if it pulls in the #_cck_store_item_users data i.e
SELECT name a.AS text, a.id AS value 
FROM #__users AS a
INNER JOIN #_cck_store_item_users AS b
ON b.id = a.id
WHERE b.funky_field = $user->funky_value

Get a VIP membership