vinpkl Posted May 20, 2015 Share Posted May 20, 2015 Hi all I want to show subcategories on only the selected dealerBut the below code is showing subcategories on all dealers. » Blackberry (3) » Battery (2) » Samsung (1) » Battery (1) If Blackberry dealer is selected then only its subcategories should be visible.Samsung subcategories should be hidden. <?php $qry_sub="select distinct s.subcid, s.subname from subcategories as s INNER JOIN producttable as p ON s.subcid = p.subcatg and p.dealerid = ".$dealer_id." and p.status='Y'"; //echo $qry_sub; echo "<ul>"; $result_sub=mysql_query($qry_sub); while($row_sub=mysql_fetch_array($result_sub)) { echo "<li></li>"; } echo "</ul>"; ?> Thanks Vineet Quote Link to comment https://forums.phpfreaks.com/topic/296416-join-subcategories-problem/ Share on other sites More sharing options...
Solution cyberRobot Posted May 20, 2015 Solution Share Posted May 20, 2015 Have you tried using the WHERE clause? http://www.techonthenet.com/mysql/where.php If I'm understanding the problem correctly, you basically need to get the results WHERE the dealer ID is equal to the one chosen. Quote Link to comment https://forums.phpfreaks.com/topic/296416-join-subcategories-problem/#findComment-1512296 Share on other sites More sharing options...
vinpkl Posted May 21, 2015 Author Share Posted May 21, 2015 Thanks Cyberrobot Got it working now Vineet Quote Link to comment https://forums.phpfreaks.com/topic/296416-join-subcategories-problem/#findComment-1512370 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.