Jump to content

Big Problem with mysql :(


Demonic

Recommended Posts

can you give me a brief idea

topics table
[quote]
CREATE TABLE `topics` (
  `id` int(9) NOT NULL auto_increment,
  `timestamp` int(20) NOT NULL default '0',
  `fid` int(4) NOT NULL default '0',
  `title` varchar(255) NOT NULL default '',
  `post` longtext NOT NULL,
  `username` varchar(32) NOT NULL default '',
  `last_post_username` varchar(32) NOT NULL default '',
  `replies` int(9) NOT NULL default '0',
  `views` int(9) NOT NULL default '0',
  `sticky` int(10) NOT NULL default '1',
  `closed` int(10) NOT NULL default '1',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=31 ;
[/quote]

replies table
[quote]
-- Host: localhost
-- Generation Time: Aug 29, 2006 at 07:35 AM
-- Server version: 4.0.27
-- PHP Version: 4.4.2
--
-- Database: `nev_php4skill`
--

-- --------------------------------------------------------

--
-- Table structure for table `replies`
--

CREATE TABLE `replies` (
  `id` int(9) NOT NULL auto_increment,
  `tid` int(9) NOT NULL default '0',
  `post` longtext NOT NULL,
  `username` varchar(32) NOT NULL default '',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=14 ;
[/quote]
Link to comment
https://forums.phpfreaks.com/topic/18967-big-problem-with-mysql/#findComment-81987
Share on other sites

When someone adds a new reply you have to get it to edit the `timestamp` of the topic.

Heres a couple things i notice you may also change...

  `replies` int(9) NOT NULL default '0',

This is not needed. You can use a query like "SELECT * FROM replies WHERE tid='$tid'" then use mysql_num_rows() on the query to find out how many replies there are...

You may want to add Time of first posting for replies and topics.
Link to comment
https://forums.phpfreaks.com/topic/18967-big-problem-with-mysql/#findComment-81991
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.