I'm at a loss...lol
Im trying to figure something out, and I'm not even sure what terms would describe it, which makes my google searches fruitless....
I have a master/detail page.
The master page lists out the records, and, obviously, the details page, is the details of those records.
What I needed to do was pull data from 3 tables
videos
tags
products
I went and modified the SELECT, it now looks like:
$query_video_library = "SELECT c.product as product_name, b.name as name, a.product as product, a.product_id as product_id, a.small_thumbnail as small_thumbnail, a.title as title, a.description as description, a.video_length as video_length, a.channel_id as channel_id, a.id as linkid, a.`channel_id`, a.`channel_id` FROM videos a INNER JOIN tags b ON a.channel_id = b.id INNER JOIN products c ON a.product_id = c.id";
This works fine. (maybe a better way to handle it, i dunno)
When the page is rendered, they are all displayed.
However, I now need to add in a dropdown that will sort the records by tags.
What I have ended up creating is this:
if(isset($_POST['channel_sort']) or isset($_POST['product']) or isset($_POST['solution'])){
$newchannel = $_POST['channel_sort'];
$query_video_library = "SELECT c.product as product_name, b.name as name, a.product as product, a.product_id as product_id, a.small_thumbnail as small_thumbnail, a.title as title, a.description as description, a.video_length as video_length, a.channel_id as channel_id, a.id as linkid, a.`channel_id`, a.`channel_id` FROM videos a INNER JOIN tags b ON a.channel_id = b.id INNER JOIN products c ON a.product_id = c.id WHERE a.channel_id = '$newchannel'";
} else {
$query_video_library = "SELECT c.product as product_name, b.name as name, a.product as product, a.product_id as product_id, a.small_thumbnail as small_thumbnail, a.title as title, a.description as description, a.video_length as video_length, a.channel_id as channel_id, a.id as linkid, a.`channel_id`, a.`channel_id` FROM videos a INNER JOIN tags b ON a.channel_id = b.id INNER JOIN products c ON a.product_id = c.id";
}
When someone chooses an item from the drop down.... the SQL changes.
This all still works.... somehow.
PROBLEM:
I cannot add in any pagination for some reason. Dreamweaver tells me "video_library" doesn't exist., when it clearly does. The Dreamweaver bindings panel does not show "video_library" and in my server behaviors it says the repeat region "video_library" doesn't exist when i click on it (has red ! ) - it defaults to "channel_sort"
I fear that I will only end up with more problems with this method.
My logic is telling me I need some sort of .. I guess "if" statement all rolled up into one SQL statement, or something.
I still need to add in another drop down for products ... and possibly another for solutions... AND the pagination.
A big thanks to anyone who can shed light on this mess.