M
M
Miko132018-05-08 14:42:24
PHP
Miko13, 2018-05-08 14:42:24

Why is the request not working in RedBean?

There is a questionnaire table
5af18af879a6b555594314.jpeg
On the page I derive data from it using RedBean.

$answers = R::find('questionnaire', 'date = ?', array($date));

Instead of person_id, using a many-to-one relationship, I display the last name and first name from the person table
5af18bde01e96269981085.jpeg
foreach ($answers as $answer) {
            $l_name = $answer->person['last_name'];
            $f_name = $answer->person['first_name'];
......
}

Instead of theme_id, I'm trying to display the name field from the themes table. However, if in the first case everything goes fine, then the theme name does not display. Connections: I can not understand what the problem is and what needs to be done?
5af18c3e91201339426742.jpeg$themes = $answer->themes['name'];
5af18ce2242b7727011342.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Popov, 2018-05-08
@Miko13

It's all about the name. The themes table, so the link should be named themes_id, this is stated in the documentation. Be careful and check all connections.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question