I'm using laravel to execute dynamic query strings sent by the front-end.
This is a dev environment used to speed up a development process.
Since I don't know what the queries will look like, I can't really use laravel query builder.
So this
$users = DB::table('look_up_lists')
->leftJoin('look_up_list_values', 'look_up_lists.id', '=', 'look_up_list_values.look_up_list_id')
->where('look_up_list_values.id', '=', 99)
->get();
WIll actually look like this
select * from `look_up_lists` left join `look_up_list_values` on `look_up_lists`.`id` = `look_up_list_values`.`look_up_list_id` where `look_up_list_values`.`id` = 99
In PHPmyAdmin, even when no results are thrown, you can see the columns involved.
This is exactly what I need, and I can't figure out a way to do this. I managed to get the columns involved as long as there are results, but not when I don't have any.
I tried this:
$sth = DB::getPdo()->prepare($query);
$sth->execute();
return $sth->fetchALl(\PDO::FETCH_OBJ);
again, works as long as there are results.
I'm stuck for days with this, can anyone help?