如何选择正确的Joomla数据库表?

时间:2022-08-16 19:30:22

My Joomla website DB is

我的Joomla网站数据库是

mysite_2

I have a table

我有一张桌子

mysite_2 »Table: TABLE 2

How should I access it?

我该如何访问它?

$query->select($db->qn(array('*')))
      ->from($db->qn('**WHAT SHOULD I WRITE HERE?**'))

1 个解决方案

#1


0  

Since you have a space in the table name, then you should write:

由于表名中有空格,因此您应该写:

$query->select($db->qn(array('*')))
  ->from($db->qn('`TABLE 2`'))

Generally, all the fields and the table names in MySQL must be encapsulated with backticks.

通常,MySQL中的所有字段和表名都必须使用反引号进行封装。

#1


0  

Since you have a space in the table name, then you should write:

由于表名中有空格,因此您应该写:

$query->select($db->qn(array('*')))
  ->from($db->qn('`TABLE 2`'))

Generally, all the fields and the table names in MySQL must be encapsulated with backticks.

通常,MySQL中的所有字段和表名都必须使用反引号进行封装。