The web video script that I'm working on modifying currently allows for submitting videos, via upload Form.
Among other fields, the upload Form allows the uploader to select a subcategory.
I believe the code below is querying the database to get the COUNT where the 'sub_category_id' exists.
If it is found then it sets another variable, $sub_category to the value of that ID.
(The subcategory id's are stored in the 'LANGS' table > 'lang_key' column).
Does what I believe this code is doing sound correct?
My next question is, regarding "sets another variable, $sub_category to the value of that ID"
how can I set another variable to the value of the ID's corresponding sub category 'name'
(which is also stored in the 'langs' table > 'names' column) ?
I look forward to any assistance.
Among other fields, the upload Form allows the uploader to select a subcategory.
I believe the code below is querying the database to get the COUNT where the 'sub_category_id' exists.
If it is found then it sets another variable, $sub_category to the value of that ID.
(The subcategory id's are stored in the 'LANGS' table > 'lang_key' column).
Does what I believe this code is doing sound correct?
PHP:
$sub_category = 0;
if (!empty($_POST['sub_category_id'])) {
$is_found = $db->where('type',PT_Secure($_POST['category_id']))->where('lang_key',PT_Secure($_POST['sub_category_id']))->getValue(T_LANGS,'COUNT(*)');
if ($is_found > 0) {
$sub_category = PT_Secure($_POST['sub_category_id']);
}
}
My next question is, regarding "sets another variable, $sub_category to the value of that ID"
how can I set another variable to the value of the ID's corresponding sub category 'name'
(which is also stored in the 'langs' table > 'names' column) ?
I look forward to any assistance.