Trying to add search category

The video-web script that I’m using allows users to upload video, and to search for videos by keyword. The script allows for a user/uploader to choose a ‘channel’ to upload to (and a sub-category). I had help adding the ability to search by channel. Now, I’m interested in adding the ability to search also by sub-category. After looking at this part of the search.php file:

 if (is_numeric($channel)) {
	$page_guery	= "SELECT indexer FROM videos WHERE approved = 'yes' AND public_private = 'public' AND channel_id = $channel AND (title like '%$keyword%' or tags like '%$keyword%' or description like '%$keyword%')";
	$search_query	= "SELECT $type_query_rows FROM videos WHERE approved = 'yes' AND public_private = 'public' AND channel_id = $channel AND (title like '%$keyword%' or tags like '%$keyword%' or description like '%$keyword%') LIMIT "; // $set_limit, $limit";
} else {
	$page_guery	= "SELECT indexer FROM videos WHERE approved = 'yes' AND public_private = 'public' AND (title like '%$keyword%' or tags like '%$keyword%' or description like '%$keyword%')";
	$search_query	= "SELECT $type_query_rows FROM videos WHERE approved = 'yes' AND public_private = 'public' AND (title like '%$keyword%' or tags like '%$keyword%' or description like '%$keyword%') LIMIT "; // $set_limit, $limit";
}

And learning that the sub-category table has these columns: sub_channel_id, parent_channel_id, sub_channel_name, sub_channel_name_seo, sub_channel_description, date_created,

I was told “You want something that relates either the sub_channel_id to the video_id; or
the sub_channel_id to the channel_id AND the channel_id to the video_id.
This has to have one ‘index’ or the other to somewhere to be functional at all”.

The ‘channel’ table has ‘channel_id’. The ‘videos’ table has: indexer, video_id, channel_id, sub_channel_id, etc.

So, as far as Step 1, of this modification, which ‘index’, do you think I should I add to the sub_channels table?

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.