User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 455,979 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,786 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 496 | Replies: 5
Reply
Join Date: Feb 2007
Posts: 10
Reputation: killer007 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
killer007 killer007 is offline Offline
Newbie Poster

Question How To Show Latest Sub Categories.

  #1  
Nov 28th, 2007
Well Guys i really need you guys help.
I want to Show (display) Last 10 Categories Here is Sql Table for Categories.what i think is it can be done with 'cat_id',but i am not really getting this .anybody can help me ?


CREATE TABLE `categories` (
  `cat_id` int(10) unsigned NOT NULL auto_increment,
  `cat_name` varchar(255) NOT NULL default '',
  `cat_description` text NOT NULL,
  `cat_parent_id` int(10) unsigned NOT NULL default '0',
  `cat_hits` int(10) unsigned NOT NULL default '0',
  `cat_order` int(10) unsigned NOT NULL default '0',
  `auth_viewcat` tinyint(2) NOT NULL default '0',
  `auth_viewimage` tinyint(2) NOT NULL default '0',
  `auth_download` tinyint(2) NOT NULL default '0',
  `auth_upload` tinyint(2) NOT NULL default '0',
  `auth_directupload` tinyint(2) NOT NULL default '0',
  `auth_vote` tinyint(2) NOT NULL default '0',
  `auth_sendpostcard` tinyint(2) NOT NULL default '0',
  `auth_readcomment` tinyint(2) NOT NULL default '0',
  `auth_postcomment` tinyint(2) NOT NULL default '0',
  PRIMARY KEY  (`cat_id`),
  KEY `cat_parent_id` (`cat_parent_id`),
  KEY `cat_order` (`cat_order`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Location: Cavite,Philippines
Posts: 508
Reputation: ryan_vietnow is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 68
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: How To Show Latest Sub Categories.

  #2  
Nov 28th, 2007
"Select * from categories order by cat_id desc"
"death is the cure of all diseases..."
http://ryantetek.wordpress.com
Reply With Quote  
Join Date: Sep 2007
Location: Budapest
Posts: 252
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 14
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: How To Show Latest Sub Categories.

  #3  
Nov 28th, 2007
select * from mytable limit 10 order by id desc
Reply With Quote  
Join Date: Aug 2007
Location: Cavite,Philippines
Posts: 508
Reputation: ryan_vietnow is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 68
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: How To Show Latest Sub Categories.

  #4  
Nov 28th, 2007
Ooh,I didn't see the last 10 thing.anyway,here it goes:

"Select * from categories order by cat_id desc limit 10"

to fatihpiristine:
dude,the order by must come first before the limit thing.
"death is the cure of all diseases..."
http://ryantetek.wordpress.com
Reply With Quote  
Join Date: Sep 2007
Location: Budapest
Posts: 252
Reputation: fatihpiristine has a little shameless behaviour in the past 
Rep Power: 0
Solved Threads: 14
fatihpiristine's Avatar
fatihpiristine fatihpiristine is offline Offline
Posting Whiz in Training

Re: How To Show Latest Sub Categories.

  #5  
Nov 28th, 2007
i know... i put it there to give some idea.
dont have to work right
Reply With Quote  
Join Date: Feb 2007
Posts: 10
Reputation: killer007 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
killer007 killer007 is offline Offline
Newbie Poster

Re: How To Show Latest Sub Categories.

  #6  
Dec 11th, 2007
Thanks Guys for helping me , its working now ..
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 9:21 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC