TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 01-29-2009, 01:34 PM   #1 (permalink)
jon
The Visitor
 
jon's Avatar
 
Join Date: May 2005
Posts: 4
Thanks: 0
jon is on a distinguished road
Default Probably a very easy mysql question.

I'm working on a hilariously simple forum script. Right now to grab all of the thread information I'm doing the following query.

PHP Code:
$sql "select thread.ID, title, thread, thread.date, views, name, avatar from thread, users where userid=users.ID  order by thread.date DESC;"
That works fine but I'd like to order the threads not by the date that they were created but by the latest comment made in them.

I have another table called "comments". Here is my table structure.



thread.ID in the "thread" table and threadid in the "comments" table match up.

How do I alter my original query so that I can order by comments.date? I've messed about and tried everything I can think of but it always fails.

Incidentally you can view the live fail forum here.
__________________
yesthat.com
jon is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a MySQL class Andrew General 12 07-14-2009 03:49 PM
Securing your MySQL Queries with Sprintf Wildhoney General 26 03-18-2008 06:52 PM
MySQL Sell Up Alan @ CIT The Lounge 12 01-17-2008 05:46 PM
Error in connecting to MySQL via PHP EyeDentify MySQL & Databases 0 01-03-2008 01:06 PM
Notepage like application to open large MySQL files Wildhoney General 6 12-07-2007 02:18 PM


All times are GMT. The time now is 10:44 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design