Drupal 8从表中获取数据?

时间:2016-09-23 10:04:13

标签: drupal-8

这是我的代码。

     $connection = Database::getConnection();
    $sth = $connection->select('node_field_word_record', 'x')
        ->fields('x', array('field_word_record_useruuid'));
    $data = $sth->execute();
    $results = $data->fetchAll(\PDO::FETCH_OBJ);
    print_r($results);

但$ _results是空的。

table

这是错误信息。

Drupal\Core\Database\DatabaseExceptionWrapper:Drupal\record_json\Controller\RecordJsonController->save_words() 中的 SQLSTATE[42S02]: Base table or view not found: 1146 Table 'fire.node_field_word_record' doesn't exist: SELECT x.field_word_record_useruuid AS field_word_record_useruuid FROM {node_field_word_record} x;

地方帮助我们!

1 个答案:

答案 0 :(得分:0)

对我这些人来说纯粹是愚蠢的,rong是node_field_word_record,缺少_,正确的表名是node__field_word_record