Answer the question
In order to leave comments, you need to log in
How to get query from database in plugin?
In the onAfterRoute method of the plugin, I make a request to the database, an empty response comes, I copied the request to phpmyadmin, the result is
$query = $db->getQuery(true);
$query->select('refs.*');
$query->select('users.username');
$query->from($db->qn('#__pharaoh_refs', 'refs'));
$query->leftJoin($db->qn('#__users', 'users') . "ON " . $db->qn('refs.uid') . " = " . $db->qn('users.id'));
$query->where($db->qn('refs.code') . "=" . $db->q($code));
$db->setQuery($query);
$res = $db->loadAssoc();
echo "$query<br>"; //в phpmyadmin есть результат
echo "<pre>";
print_r($res); // Пустой массив
echo "</pre>";
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question