vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   A n00b question (https://vborg.vbsupport.ru/showthread.php?t=117125)

Damien2005 05-30-2006 02:46 PM

A n00b question
 
Hello all..

Im realy a n00b with php so i hope to find some help here..
I try to include forum.title AS fot in this piece of code.. But when i add it i get a database error.. what do a wrong :banana:

Cheerz, Damien

Code:

$getstats_threads = $db->query_read("
        SELECT
                thread.threadid, thread.title, thread.lastpost, thread.forumid, thread.replycount, thread.lastposter, thread.dateline, IF(views<=replycount, replycount+1, views) AS views, thread.visible, user.username, user.userid, user.usergroupid, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
                " . iif($deljoin, ", NOT ISNULL(deletionlog.primaryid) AS isdeleted, deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason") . "
        FROM " . TABLE_PREFIX . "thread AS thread
                LEFT JOIN  " . TABLE_PREFIX . "user AS user ON (user.username = thread.lastposter)
                $deljoin
                WHERE NOT ISNULL(thread.threadid)
                $excludedforums
                " . iif(!$deljoin, "AND thread.visible <> 2") . "
        ORDER BY lastpost DESC LIMIT 0, $displayrecords");


Alan @ CIT 05-30-2006 03:49 PM

What database error did you get?

Damien2005 05-30-2006 04:59 PM

Quote:

Originally Posted by Alan @ CIT
What database error did you get?

Hello Alan,

Thanks for your replay

Cheerz
Damien..

I get this error..



Code:

Database error in vBulletin 3.5.4:

Invalid SQL:
SELECT forum.title, userid, usergroupid, IF(displaygroupid=0, usergroupid, displaygroupid) AS displaygroupid, username, posts FROM user ORDER BY posts DESC LIMIT 0, 5;

MySQL Error  : Unknown column 'forum.title' in 'field list'
Error Number : 1054
Date        : Tuesday, May 30th 2006 @ 07:56:53 PM
Script      : http://www.test.orgindex.php
Referrer    : http://www.test.org/index.php?do=head
IP Address  : 282.76.244.35
Username    : vb_forum
Classname    : vb_database


Silverslide 05-30-2006 07:36 PM

Are you sure forum.title exists?
and u want to extract from table user?
Isn't there a prefix?


All times are GMT. The time now is 09:31 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.01344 seconds
  • Memory Usage 1,726KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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