vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Getting the last post of a specific topic (https://vborg.vbsupport.ru/showthread.php?t=95708)

Jorim 09-06-2005 10:50 AM

:up: Yeah, it works :banana:

Thanks guys :D

[edit] (interesting option this...)

++++, it isn't working at all :( I looked at the wrong page, very stupid...

$news stays empty :(

Marco van Herwaarden 09-06-2005 11:14 AM

Lol, sorry but that query is totally wrong. :D
thread.lastpost is a timestamp, not a postid.

Use the following, this should work (if 7348 is an existing threadid):
PHP Code:

$getnews $DB_site->query_first(
        SELECT * 
        FROM " 
TABLE_PREFIX "post AS post 
        WHERE post.threadid=7348
        AND post.visible = 1
        ORDER BY post.dateline DESC
        LIMIT 1"
);  
print_r($getnews); 


Jorim 09-06-2005 12:32 PM

That's not funny :p but everything works now. Thank you very very mutch! :D

I've got one final question and then I'l shut up :) I'd like te have the attachement aswel.

Will this work:
PHP Code:

$news $DB_site->query_first("  
        SELECT pagetext, attach 
        FROM " 
TABLE_PREFIX "post AS post  
        WHERE post.threadid=884 
        AND post.visible = 1 
        ORDER BY post.dateline DESC 
        LIMIT 1"
); 

Or do I have to use extra query's for that ??

Marco van Herwaarden 09-06-2005 12:34 PM

No, that will not work. :D

'attach' will not contain the attachment data. How to retrieve the attachment data depends on how your attachments are stored (database/filesystem), but is much more complicated then just a query.

Jorim 09-06-2005 12:36 PM

I thought so. Is it possible to get the attachement of that specific post and can you help me?

Thanks again :D

Marco van Herwaarden 09-06-2005 12:36 PM

Previous reply updated.

Jorim 09-06-2005 05:05 PM

Quote:

Originally Posted by MarcoH64
Previous reply updated.

I'm using the normal settings of vBulletin I guess that's with the database. I've got a few table's with attachement information...

This query works, but the part to display the image that's attached (that's what I want) won't. What do I wrong??? :ermm:

PHP Code:

$news $DB_site->query_first("  
        SELECT post.pagetext, post.postid
        FROM " 
TABLE_PREFIX "post AS post
        WHERE post.threadid=884
        ORDER BY post.dateline DESC
        LIMIT 1"
);

$attach $DB_site->query_first("  
        SELECT attachment.filename, attachment.filesize, attachment.visible, attachmentid, counter 
        FROM " 
TABLE_PREFIX "attachment AS attachment
        WHERE attachment.postid = 
{$news['postid']}");
        
//$attachment['attachmentextension'] = file_extension($attach['filename']);
//$attachment['filename'] = $attach['filename'];
//$attachment['attachmentid'] = $attach['attachmentid'];
//$attachment['filesize'] = vb_number_format($attach['filesize'], 1, true);
//$attachment['counter'] = $attach['counter'];
//eval('$attachment = "' . fetch_template('postbit_attachment') . '";');
//$attachment = str_replace('"attachment.php', '"' . $vboptions['bburl'] . '/attachment.php', $attachment);
$attachment '<a href="' $vboptions['bburl'] . '/attachment.php?' $session['sessionurl'] . 'attachmentid=' $attach['attachmentid'] . '" target="_blank"><img border="0" src="' $vboptions['bburl'] . '/attachment.php?' $session['sessionurl'] . 'attachmentid=' $attach['attachmentid'] . '&amp;stc=1&amp;thumb=1" /></a>'

Fixed it :D:D:D:D

Thanks everybody for your help! :up:

PHP Code:

$news $DB_site->query_first("  
        SELECT post.pagetext, post.postid
        FROM " 
TABLE_PREFIX "post AS post
        WHERE post.threadid=884
        ORDER BY post.dateline DESC
        LIMIT 1"
);

$attach $DB_site->query_first("  
        SELECT attachment.filename, attachment.filesize, attachment.visible, attachmentid, counter 
        FROM " 
TABLE_PREFIX "attachment AS attachment
        WHERE attachment.postid = 
{$news['postid']}");
        
$attachment['attachmentextension'] = file_extension($attach['filename']);
$attachment['filename'] = $attach['filename'];
$attachment['attachmentid'] = $attach['attachmentid'];
$attachment['filesize'] = vb_number_format($attach['filesize'], 1true);
$attachment['counter'] = $attach['counter'];
eval(
'$attachment = "' fetch_template('postbit_attachmentimage') . '";');
$attachment str_replace('"attachment.php''"' $vboptions['bburl'] . '/attachment.php'$attachment); 



All times are GMT. The time now is 04:18 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.01218 seconds
  • Memory Usage 1,756KB
  • 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
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete