PDA

View Full Version : A n00b question


Damien2005
05-30-2006, 02:46 PM
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

$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
What database error did you get?

Hello Alan,

Thanks for your replay

Cheerz
Damien..

I get this error..



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?