Skip to content
Advertisement

comparing column in database to values in array of objects

i have this array of objects as a result of the following code:

JavaScript

it produces something like this :

JavaScript

next step, sending this array to model like this:

JavaScript

next, filtering like this:

JavaScript

i want to filter the rows based on the values in the $varIds array of objects, but this does not work as the where_in clause gives error array to string conversion, so how to compare the value of the var_id column with the values in $varIds?

Advertisement

Answer

i had to first convert array of objects into array of values like this :

JavaScript

then :

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement