Jump to content

how to make a sub-category here?


Recommended Posts

Hello W3S, it's been a while since i've posted something in here :P, mostly coz of my studies -.-'.

 

Anyways, i've had some time off.. a week to be more exacly, so i was looking back at one of my projects, and i need some help yet again with some of my coding.

 

I have tried building a category list with a sub-category in it.

 

And it works great! Only problem is that i only want each sub-category item to show under each category item when clicked on the individually item.. if you get what i mean Oo...

 

I could make a drop-down menu from one of my latest project, but i dont wont that and either does the customer...

here is my code for the category AND sub-category list:

			echo left_box_start("Server Category List");				// SCL = SERVER CATEGORY LIST				$scl_query = "SELECT ".sqlesc('id').", ".sqlesc('name')." FROM scl";				$scl_result = mysql_query($scl_query)or sqlerr(__FILE__, __LINE__);				echo "<table border='0' cellpadding='0' cellspacing='0' width='100%'>n";									//Checking to see if there is any rows to take...					if(mysql_num_rows($scl_result) < (int)0)					{						echo "ttttttt<tr>";							//echo "<td colspan='2'>";							echo "<td>";								echo "No Server Category Added Yet";							echo "</td>";						echo "</tr>";					}					else					{						while ($scl_row = mysql_fetch_array($scl_result, MYSQL_ASSOC))						{							echo "ttttttt<tr>";								echo "<td align='left' width='15px'>";									echo "->";								echo "</td>";																echo "<td align='left'>";									echo "<a href='webshop.php?scl_ID=" . (int)$scl_row['id']."'>";										echo $scl_row['name'];									echo "</a>";								echo "</td>";							echo "</tr>n";														// SSCL = SUB SERVER CATEGORY LIST							$sscl_query = "SELECT ".sqlesc('id').", ".sqlesc('name')." FROM sscl WHERE FK_scl_ID = " . (int)$scl_row['id'];							//$sscl_query = "SELECT * FROM sscl WHERE FK_scl_ID = " . (int)$scl_ID;							$sscl_result = mysql_query($sscl_query)or sqlerr(__FILE__, __LINE__);														//Checking to see if there is any rows to take...							if(mysql_num_rows($sscl_result) > (int)0)							{								//$sscl_row = mysql_fetch_array($sscl_result, MYSQL_ASSOC);								while ($sscl_row = mysql_fetch_array($sscl_result, MYSQL_ASSOC))								{									echo "<tr bgcolor='#999999'>";										echo "<td align='left' width='25px'>";											echo "-> ->";										echo "</td>";																				echo "<td align='left'>";											echo "<a href='webshop.php?scl_ID=".(int)$sscl_row['id']."&sscl_ID=".(int)$sscl_row['id']."'>";												echo $sscl_row['name'];											echo "</a>";										echo "</td>";									echo "</tr>";								}							}														// SSCL = SUB SERVER CATEGORY LIST							//$sscl_query = "SELECT ".sqlesc('id').", ".sqlesc('name')." FROM sscl WHERE FK_scl_ID = " . (int)$scl_row['id'];							$sscl_query = "SELECT ".sqlesc('id').", ".sqlesc('name')." FROM sscl WHERE FK_scl_ID = " . (int)$scl_ID;							$sscl_result = mysql_query($sscl_query)or sqlerr(__FILE__, __LINE__);														//Checking to see if there is any rows to take...							if(mysql_num_rows($sscl_result) > (int)0)							{								$sscl_row = mysql_fetch_array($sscl_result, MYSQL_ASSOC);								echo "<tr bgcolor='#999999'>";									echo "<td align='left' width='25px'>";										echo "-> ->";									echo "</td>";																		echo "<td align='left'>";										echo "<a href='webshop.php?scl_ID=".(int)$scl_row['id']."&sscl_ID=".(int)$sscl_row['id']."'>";											echo $sscl_row['name'];										echo "</a>";									echo "</td>";								echo "</tr>";							}						}					}				echo "tttttt</table>";			echo left_box_end();

Any ideas/fixes would be awsome, or suggestions, also good...

 

thanks if/why you would take a look at this and tell me where i am wrong x).

 

What i've been trying is with the ID from category list & with the $_GET ID from category list, same result each damn time -.-'. Hope you dudes have a solution where i dont -.-'...

 

-rootKID

post-86913-0-00214500-1393224751_thumb.png

Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...