943,895 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 861
  • PHP RSS
Dec 23rd, 2008
0

adding subcategory

Expand Post »
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, 23 views)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
knrakesh is offline Offline
35 posts
since Jul 2008
Dec 23rd, 2008
0

Re: adding subcategory

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...
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Dec 24th, 2008
0

Re: adding subcategory

Hi,
What you are exactly trying to say?

Let me know briefly or shortly.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
ashafaaiz is offline Offline
20 posts
since Dec 2008
Dec 24th, 2008
0

Re: adding subcategory

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
Reputation Points: 10
Solved Threads: 0
Light Poster
knrakesh is offline Offline
35 posts
since Jul 2008
Dec 24th, 2008
0

Re: adding subcategory

hi rakesh,
for subcategory u first create table with prid,parentid name,title..etc
and then write query as
php Syntax (Toggle Plain Text)
  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
php Syntax (Toggle Plain Text)
  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
php Syntax (Toggle Plain Text)
  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
php Syntax (Toggle Plain Text)
  1. <input name="title" type="text" class="box" id="title" size="45" <? if (isset($_GET['pid'])){?>value="<?=$subcategory?>" <? }?>>
thats it simple
Reputation Points: 21
Solved Threads: 29
Posting Whiz in Training
praveen_dusari is offline Offline
202 posts
since Jun 2008
Dec 24th, 2008
0

Re: adding subcategory

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
Reputation Points: 10
Solved Threads: 0
Light Poster
knrakesh is offline Offline
35 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: AOL block emails created from my server
Next Thread in PHP Forum Timeline: could i search images in a folder using php in offline





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC