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 ;

Recommended Answers

All 5 Replies

"Select * from categories order by cat_id desc"

Member Avatar for fatihpiristine

select * from mytable limit 10 order by id desc

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.

Member Avatar for fatihpiristine

i know... i put it there to give some idea.
dont have to work right

Thanks Guys for helping me , its working now :D ..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.