Hello,
I don’t know how to solve this problem:
I have two tables in the database:
-modx_decisions_posts:
-modx_violation_types_lists:
As you can see in the modx_decisions_posts table I store the multiple violation types ID. In some snippet I want to get the name of violation types for showing in the frontend. The problem is getting only the first value of the row. For this example is showing only Type 1 GR. The multilingual values its ok, do not pay attention.
This is my snippet:
<?php
$output = '';
if($cultureKey == 'el'){
$cultureKey = 'gr';
}
$placeholder = $field.'_'.$cultureKey;
$output = $modx->getPlaceholder($placeholder);
$sql = "SELECT i.* FROM `modx_decisions_posts` AS q LEFT JOIN `modx_violation_types_lists` AS i ON (q.violation_type = i.id);";
$result = $modx->query($sql);
$res = $result->fetch(PDO::FETCH_ASSOC);
$violation_types = $res["name_$cultureKey"];
$output .= '<p>'.$violation_types.'</p>';
return $output;