vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Last Post Minute Query (https://vborg.vbsupport.ru/showthread.php?t=52799)

Boofo 05-11-2003 12:35 PM

Last Post Minute Query
 
Logician, is there an easy way to pull out the last poster in your query for the last post minute hack? If I can do it through there, I can cut another query and have it give me the right result all at the same time. ;)

Logician 05-11-2003 05:08 PM

I believe if changing the query to this should help:

SELECT post.dateline AS lastpostminute, thread.threadid, user.username
FROM post, thread
LEFT JOIN user ON user.userid = post.userid
WHERE thread.forumid = $forumid AND thread.threadid = post.threadid
ORDER BY post.dateline DESC
LIMIT 1

Then you can use variable $lastpostminDB[username]

Boofo 05-11-2003 05:23 PM

LOL I just did this about 5 minutes ago. Here is the code I used and it seems to work.

PHP Code:

$lastpostminDB=$DB_site->query_first("SELECT post.dateline as thread.threadid, username, userid FROM post,thread WHERE thread.forumid=$forumid AND thread.threadid=post.threadid ORDER BY post.dateline DESC LIMIT 1"); 

I use $lastpostminDB[username] for the last poster and $lastpostminDB[userid] for the link to the member's profile.

Will this code work or am I just lucky right now and it will mess up later? ;)

Logician 05-11-2003 05:51 PM

I say go with my code (if it is working, I didn't test it!). For some reason getting the username from thread/post tables sometimes not works. This is why I put the left join query in my code to get it from the user table.

Boofo 05-11-2003 05:57 PM

Thank you, sir. I'll go test it now and report back. ;)

Boofo 05-11-2003 06:01 PM

Ok, tested and got no errors. How do I call the userid for the link to the user's profile now? I have been trying everything and can't find anything to work. ;)

Logician 05-11-2003 08:19 PM

SELECT post.dateline AS lastpostminute, thread.threadid, user.username, user.userid
FROM post, thread
LEFT JOIN user ON user.userid = post.userid
WHERE thread.forumid = $forumid AND thread.threadid = post.threadid
ORDER BY post.dateline DESC
LIMIT 1

Boofo 05-11-2003 08:50 PM

Thank you, again, sir. I guess I still don't have the hang of these queries, yet. ;)


All times are GMT. The time now is 09:08 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01085 seconds
  • Memory Usage 1,722KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete