adding subcategory

Reply

Join Date: Jul 2008
Posts: 32
Reputation: knrakesh is an unknown quantity at this point 
Solved Threads: 0
knrakesh's Avatar
knrakesh knrakesh is offline Offline
Light Poster

adding subcategory

 
0
  #1
Dec 23rd, 2008
Hello friends
please tell how to add ssubcategories and editing in a single page
please provide code if u have
i worked on that but iam getting errors
please help me in solving the problem
Attached Images
File Type: bmp sam.bmp (892.2 KB, 2 views)
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: adding subcategory

 
0
  #2
Dec 23rd, 2008
hello
this is same as add/edit category..
the only difference is we are showing categories and sub categories..thats all..remaining is same...
k try again, you will get...
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 19
Reputation: ashafaaiz is an unknown quantity at this point 
Solved Threads: 1
ashafaaiz ashafaaiz is offline Offline
Newbie Poster

Re: adding subcategory

 
0
  #3
Dec 24th, 2008
Hi,
What you are exactly trying to say?

Let me know briefly or shortly.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 32
Reputation: knrakesh is an unknown quantity at this point 
Solved Threads: 0
knrakesh's Avatar
knrakesh knrakesh is offline Offline
Light Poster

Re: adding subcategory

 
0
  #4
Dec 24th, 2008
I require the add subcategory and edit subcategory in a single page
and i want to add category and add subcategory with a single table
(if suppose i put the category parentid=0 and for subcategory parentid =1 )
please tell the code i have written the code for addcategory but iam unabling to write the code for addsubcategory please

Thanks in advance
Bye
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 171
Reputation: praveen_dusari is an unknown quantity at this point 
Solved Threads: 21
praveen_dusari's Avatar
praveen_dusari praveen_dusari is offline Offline
Junior Poster

Re: adding subcategory

 
0
  #5
Dec 24th, 2008
hi rakesh,
for subcategory u first create table with prid,parentid name,title..etc
and then write query as
  1. $qry2="INSERT INTO `cf_posts`(`parentid`,`title`,`content`,`dateadded`,`author`) values('".$_POST['selcategory']."','".$_POST['title']."','".$_POST['description']."',now(),'admin')";
  2. $res2=mysql_query($qry2) or die(mysql_error());

selcategory is the selection box which has category list
  1. <select name="selcategory" class="box" id="selcategory">
  2. <option value="">------Selectcategory-------</option>
  3. <?
  4. $qry4="SELECT * FROM cf_forums WHERE parentid=0";
  5. $res3=mysql_query($qry4) or die(mysql_error());
  6. while($row4=mysql_fetch_array($res3))
  7. {
  8. ?>
  9. <option class="red" value="<?=$row4['forumid']?>" >
  10. <?=$row4['title']?>
  11. </option>
  12. </select>
thats it foe adding for edit in manage page u will have a edit like
  1. <td height="22" colspan="2" align="center" ><a href="add_topic.php?pid=<?=$crow['forumid']?>" class="normlinks"><strong>Edit</strong></a></td>
in add page

simply write
  1. <input name="title" type="text" class="box" id="title" size="45" <? if (isset($_GET['pid'])){?>value="<?=$subcategory?>" <? }?>>
thats it simple
Failure is success if we learn from it
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 32
Reputation: knrakesh is an unknown quantity at this point 
Solved Threads: 0
knrakesh's Avatar
knrakesh knrakesh is offline Offline
Light Poster

Re: adding subcategory

 
0
  #6
Dec 24th, 2008
Thanks praveen
i qm having the category table in that table only i want to insert subcategory
i dont want to create seperate table for subcategory
i got with seperate table
but actually i am looking for the total categories and subcategories in a single table
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC