jasonc310771
12-08-2008, 11:30 PM
I have slowly been creating my own form all seem to be working so far and i have just to add the new lines of queries to show when each category was last updated.
below are the cutdown versions of my forum DB's
what i am after is a way to get the contents of the field 'created_on' from the `forum_topics` DB.
but for each of the categorys,
the categorys are shown and then this new query i need, needs to use the category id on showing the categorys to then look at the most recent post made in the `forum_comments` which is first referenced in the `forum_topics`
oh BTW i can not just add a new field to place this info in the the forum_category table as this would show what could be a deleted posts details and would still need to get a query to find the date of the last post anyway!
so i think this method i what i am after..
(excuse the crude method!)
select 'created_on' in `forum_comments` where 'topic_id' in `forum_comments` = 'topic_id' in `forum_topics` and 'category_id' in `forum_topics` = 'category_id' in `forum_category` and where `confirmed' in all tables = '1'
i think this is correct been over it a few time to make sure it is what i believe is needed of the query.
my Mysql tables
CREATE TABLE IF NOT EXISTS `forum_category` (
`category_id` bigint(20) NOT NULL auto_increment,
`confirmed` text,
`category` text NOT NULL,
`created_by` text NOT NULL,
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`category_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
CREATE TABLE IF NOT EXISTS `forum_topics` (
`topic_id` bigint(20) NOT NULL auto_increment,
`category_id` bigint(20) NOT NULL default '0',
`topic` longtext NOT NULL,
`username` text NOT NULL,
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
`confirmed` text,
`views` bigint(20) NOT NULL default '0',
KEY `topic_id` (`topic_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=38 ;
CREATE TABLE IF NOT EXISTS `forum_comments` (
`postcounter` bigint(20) NOT NULL auto_increment,
`topic_id` bigint(20) NOT NULL default '0',
`comment` longtext NOT NULL,
`username` varchar(65) NOT NULL default '',
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
`confirmed` text,
KEY `postcounter` (`postcounter`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=54 ;
below are the cutdown versions of my forum DB's
what i am after is a way to get the contents of the field 'created_on' from the `forum_topics` DB.
but for each of the categorys,
the categorys are shown and then this new query i need, needs to use the category id on showing the categorys to then look at the most recent post made in the `forum_comments` which is first referenced in the `forum_topics`
oh BTW i can not just add a new field to place this info in the the forum_category table as this would show what could be a deleted posts details and would still need to get a query to find the date of the last post anyway!
so i think this method i what i am after..
(excuse the crude method!)
select 'created_on' in `forum_comments` where 'topic_id' in `forum_comments` = 'topic_id' in `forum_topics` and 'category_id' in `forum_topics` = 'category_id' in `forum_category` and where `confirmed' in all tables = '1'
i think this is correct been over it a few time to make sure it is what i believe is needed of the query.
my Mysql tables
CREATE TABLE IF NOT EXISTS `forum_category` (
`category_id` bigint(20) NOT NULL auto_increment,
`confirmed` text,
`category` text NOT NULL,
`created_by` text NOT NULL,
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`category_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
CREATE TABLE IF NOT EXISTS `forum_topics` (
`topic_id` bigint(20) NOT NULL auto_increment,
`category_id` bigint(20) NOT NULL default '0',
`topic` longtext NOT NULL,
`username` text NOT NULL,
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
`confirmed` text,
`views` bigint(20) NOT NULL default '0',
KEY `topic_id` (`topic_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=38 ;
CREATE TABLE IF NOT EXISTS `forum_comments` (
`postcounter` bigint(20) NOT NULL auto_increment,
`topic_id` bigint(20) NOT NULL default '0',
`comment` longtext NOT NULL,
`username` varchar(65) NOT NULL default '',
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
`confirmed` text,
KEY `postcounter` (`postcounter`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=54 ;