mleontenko
1 month ago
143
5
General

Raw SQL query to array

Posted 1 month ago by mleontenko

I'm using a raw SQL query that selects some ids from database. It looks like this:

$query = DB::select('SELECT pr.id_obrasca_prethodne 
        FROM public."prethodneNacionalneProcjene" AS pr 
        JOIN public."obrasciProcjeneVrste" AS ob ON pr.id_obrasca = ob.id WHERE ob.status LIKE \'Prihvaćen\'');

If I output the $query variable now, I get:

[{"id_obrasca_prethodne":8},{"id_obrasca_prethodne":28}]

I need to convert the result of query to PHP array so it contains only numbers (8, 28, ...). How can I do this?

Please sign in or create an account to participate in this conversation.