Hey guys,
I have a question I've been battling for the past couple of nights, and I can't just seem to come up with a solution.
Here's what it is:
I've been developing a forum for the past couple of months now, and it's coming pretty good (<!-- m --><a class="postlink" href="http://bob.maniacalrage.net">http://bob.maniacalrage.net</a><!-- m -->); What I'm trying to do is gather the users total posts, user title (rank), and all of the topic data in one SQL query. Here is the SQL database structure:
of_posts
DATE
TITLE
TEXT
USER
IP
EDIT
SMILE
ACCESS
RID
PID
TID
BID
of_usertitles
TITLE
MINPOSTS
MAXPOSTS
To select all of the users total posts, you'd do something like:
SELECT COUNT(PID) AS P_CNT FROM of_posts WHERE USER = 'john'
Now, to select a rank:
SELECT TITLE FROM of_usertitles WHERE P_CNT >= MINPOSTS AND P_CNT <= MAXPOSTS
Now, like I said, I need all of the data from of_posts, and at the same time, their total posts and usertitle.
Any help is greatly appreciated, and you will receive credit when the forum is released.
I have a question I've been battling for the past couple of nights, and I can't just seem to come up with a solution.
Here's what it is:
I've been developing a forum for the past couple of months now, and it's coming pretty good (<!-- m --><a class="postlink" href="http://bob.maniacalrage.net">http://bob.maniacalrage.net</a><!-- m -->); What I'm trying to do is gather the users total posts, user title (rank), and all of the topic data in one SQL query. Here is the SQL database structure:
of_posts
DATE
TITLE
TEXT
USER
IP
EDIT
SMILE
ACCESS
RID
PID
TID
BID
of_usertitles
TITLE
MINPOSTS
MAXPOSTS
To select all of the users total posts, you'd do something like:
SELECT COUNT(PID) AS P_CNT FROM of_posts WHERE USER = 'john'
Now, to select a rank:
SELECT TITLE FROM of_usertitles WHERE P_CNT >= MINPOSTS AND P_CNT <= MAXPOSTS
Now, like I said, I need all of the data from of_posts, and at the same time, their total posts and usertitle.
Any help is greatly appreciated, and you will receive credit when the forum is released.