I have a table and when I click to view a specific row in more detail I am taken to a page with the following URL:
webproject/projects/1
In my PDP i want to obtain this value and run it into a RedBean call as follows:
public function projects()
{
return R::findAll('projects', 'themeid = [id from URL]');
}
Any help would be appreciated.
Thank you.
Assuming that you have your id into a variable $url_id
you should change a little your code:
return R::findAll('projects', 'themeid = ?', [$url_id]);
or
return R::findAll('projects', 'themeid = :id', [':id' => $url_id]);
so, what you need in this case is replace your values with ?
signal and on the third parameter pass an array with values.
Remember, the number of ?
must be the same of array length