When using
$optionquery = "SELECT OptionId FROM Option_Table WHERE (OptionType = ?)";
// Bind parameter for statement
$optionstmt->bind_param("s", $selected_option);
This is fine, but if I want to use the WHERE clause to look for the variable within a folder, how is it suppose to be written? Is it like this below?
$optionquery = "SELECT OptionId FROM Option_Table WHERE (OptionType = 'VideoFiles/?')";
// Bind parameter for statement
$optionstmt->bind_param("s", $selected_option);
or like this:
$optionquery = "SELECT OptionId FROM Option_Table WHERE (OptionType = ?)";
// Bind parameter for statement
$optionstmt->bind_param("s", 'VideoFiles/$selected_option');
Does the single quote go around both the foldername and the variable name or does it just go around the folder name?
You need to use the latter
There are a number of ways to quote the string, either of the following are fine:
Putting a variable in single quotes
'however will not work. The variable will not be translated to its actual value, you will get the literal string$selected_optionin the query if you use single quotes.