English 中文(简体)
I m 遇到MySQL错误,显示一栏缺失。 然而,在phpMyAdmin,上述一栏明显出现在数据库中[复制]。
原标题:I m encountering a MySQL error indicating a missing column. However in phpMyAdmin the mentioned column is visibly present in the database [duplicate]

我成功地在我拥有PHP4的东道环境中安装了一个老论坛文字,即VBulletin 2。 虽然我承认使用PHP4可能造成的安全关切,但我打算恢复我创建的首期论坛之一。

然而,论坛顺利运作,使我能够开展一切必要的行动。 然而,在试图进入用户小组时,我遇到了错误。

Database error in vBulletin 2.3.11:
Invalid SQL: SELECT privatemessage.*,touser.username AS tousername,fromuser.username AS fromusername,icon.title AS icontitle,icon.iconpath
FROM privatemessage,user AS touser,user AS fromuser
LEFT JOIN icon ON icon.iconid=privatemessage.iconid
WHERE privatemessage.userid= 1
AND folderid=0
AND touser.userid=privatemessage.touserid
AND fromuser.userid=privatemessage.fromuserid
AND messageread=0
ORDER BY dateline DESC

mysql error: Unknown column privatemessage.iconid in on clause mysql error number: 1054

我可以说出一个新的路,但当我回答时,我会发现这一错误:

Database error in vBulletin 2.3.11:
Invalid SQL: SELECT user.*, style.templatesetid
            FROM subscribethread,user,usergroup
                LEFT JOIN style ON (IF(user.styleid=0, 1, user.styleid)=style.styleid)
            WHERE subscribethread.threadid= 1 
            AND subscribethread.userid=user.userid
            AND usergroup.usergroupid=user.usergroupid
            AND user.userid<> 1 
            AND user.usergroupid<> 3 
            AND usergroup.canview = 1
            AND user.lastactivity> 1703928997 

mysql error: Unknown column  user.styleid  in  on clause 
mysql error number: 1054

在通过PhpMyAdmin进行视察后,我证实确实存在这几栏。 尽管得到了这一确认,我仍对问题的根源感到迷惑。 谁能提供援助或见解?

I tried to recreate the column and also changing the order but nothing happened.

问题回答

你将style式JOIN和JOIN明确结合起来。 混合式JOIN不太优先,然后是JOIN。 页: 1

FROM subscribethread,user,usergroup
LEFT JOIN style ON (IF(user.styleid=0, 1, user.styleid)=style.styleid)

事实上

FROM subscribethread,user,
(
                          usergroup
LEFT JOIN style ON (IF(user.styleid=0, 1, user.styleid)=style.styleid)
)

很明显,在添加的括号中,提及<编码>用户的表格(添加括号的外表)并不合法。

The most simple fix - replace a comma with CROSS JOIN:

FROM subscribethread
CROSS JOIN user
CROSS JOIN usergroup
LEFT JOIN style ON (IF(user.styleid=0, 1, user.styleid)=style.styleid)




相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签