SC_Lookup issue with Brackets

I am building a control form that will allow users to create new entities (crops). To do this they must select two values (plantId and containerid). These two values will then be used to look up the matching productId. My first two fields gather the plant and container selections. I then plan to use an Ajax event on the change of the container field to populate the productId field (this is required to insert data into the crop table)

My PHP Method is as follows:

$plant = {plantId};
$cont = {containerId};
sc_lookup(results,“SELECT prodId
FROM products
WHERE
plantId =$plant AND containerId =$cont”);

if(!empty({results})) {

	productId{} = {results [0] [0]};
};

I am getting this error when I try to run the application:
Parse error: syntax error, unexpected ‘{’ in C:\Program Files\NetMake\v9-php73\wwwroot\scriptcase\app\GenGroTec\control_add_crop\control_add_crop_apl.php on line 3456

This error points to the second to last line in the PHP Method:

productId{} = {results [0] [0]};

I have checked the syntax and it appears to follow the examples I have found in the documentation.

Any advice would be greatly appreciated. Thanks in advance Ed.

Hi,
try this
why do you assign the field to a variable?

sc_lookup(results,“SELECT prodId
FROM products
WHERE
plantId ={plantId} AND containerId ={containerId}”);

don’t forget to use sc_sql_injection(field) when make queries to avoid security issues.

regards

Thanks I will try this.