Jump to content

Recommended Posts

As far as it goes for me I have the switch() working, but not to what im trying to do. This is for a "media" page where I have 3 different categories "Music", "Videos" and "Photos". I'm trying to get it so when you goto the "Media" page it will show just the 3 categories, that section works but it is also showing the sub categories for all them categories. So for what im trying to do is when viewing the "media" page, it will display the 3 categories, then when selecting the category it will display the "sub categories". and then when you select the "sub category" it will display the contents of that "sub category"

 

should i be trying to do this a different way? or do i have something wrong here? lol

 

here is my switch() code

<?php
$cat = (isset($_GET["m_cat"])) ? (intval($_GET["m_cat"])) : 0;
 switch($_GET["b"]=="true")
	{
		default :
		if("/ffy/media.php"==$_SERVER['PHP_SELF'])
			{
				echo "Select a Category";
			}

		case "false":
		if($_GET["m_cat"]==$cat)
			{

				echo "<font size='3'>";
				$dcat = mysql_query("SELECT * FROM media_sub_cat WHERE m_cat=$cat")
					or die("mySQL Query Failed: " .mysql_error());

				while($catrow = mysql_fetch_array($dcat)) {
					list($id, $m_sub_cat, $m_cat) = $catrow;

				echo ": <font class='myFont'><a href='media.php?b=true&cat=".$m_cat."&subcat=".$m_sub_cat."'>".$m_sub_cat."</a></font> ";
				}
			echo ":</font>";
			echo "Work Damb You";
			}
		break;

		case "true":
		if($_GET["cat"]==$cat && $_GET["subcat"]==$m_sub_cat)
			{

				echo "Weird...";

			}
		break;
	}
?>

Link to comment
https://forums.phpfreaks.com/topic/251208-some-issues-with-switch/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.