Jump to content

DATETIME problem


waynew

Recommended Posts

I've been building a custom forum and my DB tables look like so:

 

<?php

mysql_query(

"CREATE TABLE thread(

	thread_id BIGINT(50) NOT NULL AUTO_INCREMENT,
	user_started BIGINT(50) NOT NULL,
	title TEXT NOT NULL,
	body TEXT NOT NULL,
	last_post_time DATETIME NOT NULL,
	latest_poster_id BIGINT(50) NOT NULL,
	PRIMARY KEY(thread_id))") or die(mysql_error());

mysql_query(

"CREATE TABLE thread_post(

	thread_post_id BIGINT(50) NOT NULL AUTO_INCREMENT,
	parent_thread_id BIGINT(50) NOT NULL,
	user_posting BIGINT(50) NOT NULL,
	time_posted DATETIME NOT NULL,
	body TEXT NOT NULL,
	PRIMARY KEY(thread_post_id))") or die(mysql_error());
?>

 

When you go to the forum main page, all forum topics are ordered by last_post_time, which is a DATETIME value. The query looks like so:

 

<?php

function get_topics_listing(){
$select = mysql_query("SELECT thread_id,title,user_started,latest_poster_id,last_post_time 
FROM thread ORDER BY last_post_time DESC LIMIT 30") or die(mysql_error());
return $select;
}
?>

 

This seemed to be working fine until today when a topic with the last post time of 2008-08-31 12:40:29 came out above another newer topic with the last post time of 2008-08-31 01:52:54

 

Why would this be? Cheers for the help.

Link to comment
https://forums.phpfreaks.com/topic/122101-datetime-problem/
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.