O
O
oksana19972022-02-27 02:54:54
PHP
oksana1997, 2022-02-27 02:54:54

How to accept values ​​from another table?

Good afternoon everyone!
such question, how it is possible to accept values ​​from one table to another? and display them in the template

there are two tables c_client in it the column lot contains the ID of the
object and there is a second c_object and in it the column is also lotclientr where you need to tie up the client ID for this object

how can I make c_object.clientlot take values ​​from c_client.lot by to this object?
PDO base, twig template engine.

I'm trying to do this, it doesn't work, the request itself is like this

$clientlot = db::i()->select("
SET c_object.lot = c_client.lot
WHERE c_object.id = c_client.id");
tpl::i()->set('clientlot', $clientlot);

in the template {{clientlot}}

the database request itself

$sql = "
                    SELECT
                      c_object.*,
                      c_user.name AS __c_user__name,
                      l_object_status.name AS __l_object_status__name,
                      l_deal_type.name AS __l_deal_type__name,
                      l_object_type_price.name AS __l_object_type_price,
                      

                    FROM c_object
                    LEFT JOIN c_client ON c_client.lot = c_object.lot
                    LEFT JOIN c_user ON c_user.id = c_object.id_user
                    LEFT JOIN l_object_status ON l_object_status.id = c_object.l_object_status
                    LEFT JOIN l_deal_type ON l_deal_type.id = c_object.l_deal_type
                    LEFT JOIN l_object_type_price ON l_object_type_price.id = c_object.l_object_type_price
                    "{$this->filterSQL} GROUP BY c_object.id $pagerSql;";


can somehow through db::i()->query can be done? or

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question