Passing a variable from URL in query

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 19, 2018   (RSS)

By ciaranmac - July 19, 2018

I have a multiple items and I want to list them out depending on the variable in the url.

Each item has a list of categories to chose which could be multiple ( Field name = video_category). I am passing this variable in the URL, so if the variable is 2, then I want every item with 2 selected for the field name 'video_category' to appear.

I can do it if I put the value in manually e.g. below:

// load records from 'videos'
list($videosRecords, $videosMetaData) = getRecords(array(
'tableName' => 'videos',
'where' => ' video_category LIKE "%\t2\t%" ', // contains 4
'loadUploads' => true,
'allowSearch' => false,

but I don't know what to do to pull the variable and put it in the query.