This topic is locked
[SOLVED]

 Inserting data from multiple queris into print and list page

2/24/2018 10:19:31 AM
PHPRunner General questions
P
pell.net author

Hello,
i am trying to insert / print out data from multiple queris on List and Print page, but i am stuck with it.
Multiple queries are working properly, no issues there.

For example:
I have a list page where i get a record from db and i do additional query on that list page which is based on the record collected before.
How do I print out the result of the 2nd query into the template and print page?
Thank you

P
pell.net author 2/25/2018

if anyone gets stuck with the same problem; The solution is using php snippets.
Use global $pageObject and $cman.


global $pageObject, $cman;

$record = $pageObject->getMasterRecord();
$query = "SELECT * from table WHERE idUser = \"".$record["idUser"]."\" GROUP BY idUser";
$connection = $cman->byName("phprunner at localhost");
$qres = $connection->query($query);
echo "<div class=\"user_wrapper\">";

while ($data = db_fetch_array($qres)) {

echo "<div class=\"user\">".$data["userName"]."</div>";

}

echo "</div>";