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 ;

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.

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

This article has been dead for over six months. Start a new discussion instead.