Jump to content

Recommended Posts

First off, I'd like to say that I have almost no experience with MySQL, so I'm sorry if this is posted in the wrong forum or if my wording is a bit off.

 

My friend and I have been running a website for a couple years now, though he's been a bit too busy lately to help out. I need help with something that's probably just really easy and I don't know how to do it. I've tried searching around a few different sites and through Google for answers, but can't really find what I'm looking for...

$topicsql = "SELECT *, MAX( messages.date ) AS maxdate, topics.id AS topicid, users.id AS userid, topics.*, users.*, groups.* FROM messages, topics, users, groups WHERE messages.topic_id = topics.id AND topics.user_id = users.id AND users.group_id = groups.id AND topics.forum_id = " . $forumid . " GROUP BY topicid ORDER BY topics.status='3' DESC, topics.status='2' DESC, maxdate DESC";

Basically, what I want to do is have it not display any entries where the topic.status is 1 after a certain amount of time has passed (probably twelve hours, based on the entry's timestamp).

 

Thank you. =)

Hm, it didn't work... =/

 

Is this the correct placement for adding it in...?

SELECT *, MAX( messages.date ) AS maxdate, topics.id AS topicid, users.id AS userid, topics.*, users.*, groups.* FROM messages, topics, users, groups WHERE messages.topic_id = topics.id AND topics.user_id = users.id AND users.group_id = groups.id AND topics.forum_id = " . $forumid . " AND ( topics.status <> 1 OR NOW() - messages.date < (12*60*60)) GROUP BY topicid ORDER BY maxdate DESC

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.