Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-24-2021, 05:52 PM
svoeric svoeric is offline
 
Join Date: Apr 2008
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default VB4 queries converted to VB5 ?

I had 2 queries I ran against the db in VB4 to pull most recent posts (in a non-vb page), and all posts from a specific forum.

Wondering if someone can help me convert these to VB5.6 -- I've not quite got the vb5 DB format figured out yet

this one grabs stuff from my FYI thread --

SELECT thread.threadid, thread.title, thread.dateline, post.threadid,thread.firstpostid,
thread.lastpost, thread.visible, thread.lastposter, thread.lastposterid,
post.threadid, post.pagetext
FROM " . $TABLE_PREFIX . "thread AS thread
LEFT JOIN " . $TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)
WHERE thread.forumid =56
AND thread.visible = 1
GROUP BY thread.threadid
ORDER BY thread.lastpost DESC
LIMIT 0, " . $postret . "
");

this one shows most recent posts --

SELECT thread.threadid, thread.title, thread.dateline,
thread.lastpost, thread.visible, thread.lastposter, thread.lastposterid,
forum.forumid, forum.title as forumtitle, user.userid, usergroup.opentag, usergroup.closetag
FROM " . $TABLE_PREFIX . "thread AS thread
INNER JOIN " . $TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
LEFT JOIN " . $TABLE_PREFIX . "user AS user ON (thread.lastposterid = user.userid)
LEFT JOIN " . $TABLE_PREFIX . "usergroup AS usergroup ON (usergroup.usergroupid = user.usergroupid)
WHERE thread.forumid NOT IN($excforum)
AND thread.visible = 1
GROUP BY thread.threadid
ORDER BY thread.lastpost DESC
LIMIT 0, " . $postret . "
");

Thanks Really appreciate any help
Reply With Quote
  #2  
Old 04-24-2021, 06:34 PM
Seven Skins's Avatar
Seven Skins Seven Skins is offline
 
Join Date: Sep 2008
Location: London, UK
Posts: 1,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Download this: https://vborg.vbsupport.ru/showthread.php?t=328344

Look in this folder: Yilmaz - Hotbar vB5\core\packages\yilmazhotbar\db\mysql

You get pretty good idea what queries to use.
Reply With Quote
  #3  
Old 04-26-2021, 12:41 AM
svoeric svoeric is offline
 
Join Date: Apr 2008
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

grabbed this query, It's a ton of help, but the group by statements are causing some issues... if I remove the group by, it works.


PHP Code:
SELECT node.iconidnode.prefixidnode.nodeid as nodeidsinode.title as konubasliginode.votes as begeeninode.lastcontentauthor as uyeadinode.lastauthorid as uyeidesinode.routeidnode.lastcontentnode.creatednode.lastcontentidnode.contenttypeidnode.parentidnode.textcountnode.totalcount as replyicon.iconpathicon.title as icontitleclosure.parent as forumidesiclosure.depthforum.title as forumtitlenodeview.count as viewsxuser.usergroupiduser.usernameuser.usernametext.rawtexttext.previewimage
                FROM node 
AS node
                LEFT JOIN 
" . $TABLE_PREFIX . " closure AS closure ON (closure.child node.nodeid)
                
LEFT JOIN " . $TABLE_PREFIX . "user AS user ON (user.userid node.lastauthorid)    
                
LEFT JOIN " . $TABLE_PREFIX . "icon AS icon ON (icon.iconid node.iconid)
                
LEFT JOIN " . $TABLE_PREFIX . "nodeview AS nodeview ON (nodeview.nodeid node.nodeid)
                
LEFT JOIN " . $TABLE_PREFIX . "node AS forum ON (forum.nodeid closure.parent)
                
LEFT JOIN " . $TABLE_PREFIX . "text AS text ON (text.nodeid closure.child)
                
LEFT JOIN " . $TABLE_PREFIX . "channel AS channel ON (channel.nodeid closure.child)
                
LEFT JOIN " . $TABLE_PREFIX . "contenttype AS contenttype ON (contenttype.contenttypeid node.contenttypeid)
                
WHERE  node.parentid !=AND node.open !=AND closure.depth 1  AND node.title !='' AND node.inlist 1
                GROUP BY node
.title
                ORDER BY node
.created DESC
                LIMIT 14 


any thoughts on this ?

get this when I run With the group-by in.
failed : Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'DB_bb.node.iconid' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Reply With Quote
  #4  
Old 04-27-2021, 08:32 PM
Seven Skins's Avatar
Seven Skins Seven Skins is offline
 
Join Date: Sep 2008
Location: London, UK
Posts: 1,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this:
PHP Code:
SELECT node.iconidnode.prefixidnode.nodeidnode.titlenode.votesnode.lastcontentauthornode.lastauthoridnode.routeidnode.lastcontentnode.creatednode.lastcontentidnode.contenttypeidnode.parentidnode.textcountnode.totalcounticon.iconpathicon.titleclosure.parentclosure.depthforum.titlenodeview.countuser.usergroupiduser.usernameuser.usernametext.rawtexttext.previewimage 
FROM node 
AS node
LEFT JOIN closure 
AS closure ON (closure.child node.nodeid)
LEFT JOIN user AS user ON (user.userid node.lastauthorid)    
LEFT JOIN icon AS icon ON (icon.iconid node.iconid)
LEFT JOIN nodeview AS nodeview ON (nodeview.nodeid node.nodeid)
LEFT JOIN node AS forum ON (forum.nodeid closure.parent)
LEFT JOIN text AS text ON (text.nodeid closure.child)
LEFT JOIN channel AS channel ON (channel.nodeid closure.child)
LEFT JOIN contenttype AS contenttype ON (contenttype.contenttypeid node.contenttypeid)
WHERE  node.parentid !=AND node.open !=AND closure.depth 1  AND node.title !='' AND node.inlist 1
GROUP BY node
.titlenode.nodeidclosure.parent
ORDER BY node
.created DESC
LIMIT 5 
Reply With Quote
  #5  
Old 04-28-2021, 05:44 PM
svoeric svoeric is offline
 
Join Date: Apr 2008
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That did the trick, Thanks a ton.

one more question -- (maybe should go to new thread, IDK...)

in VB4 -- I would build a link to the thread (plus show-latest), which was easy, as you just passed showthread.php the threadID, and poof, piece of cake.

in 5, seems you need /forum/forum-name/child-name/node-id to build the direct link URL

I'm not seeing this info directly in the node table, what table do I need to join to get it ?
OR, is there a short-cut to have VB build the url with just the node-id ?

Thanks again for the help!
Reply With Quote
  #6  
Old 04-30-2021, 12:13 AM
svoeric svoeric is offline
 
Join Date: Apr 2008
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

found it!

if you direct url to yoursite.com/forum/node/nodeID
takes you right to the thread, err node
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:55 PM.


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.04744 seconds
  • Memory Usage 2,255KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete