J
J
jaygen2018-03-18 17:41:01
MySQL
jaygen, 2018-03-18 17:41:01

Getting data from the database using modx?

Good day, tell me how to remake getting data from a simple sql query to xpdo in a modx snippet

<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/sql.php');
$sqll = "SELECT * FROM modx_gallery_tags,modx_gallery_items  WHERE modx_gallery_tags.tag = '".$slim."' and modx_gallery_tags.item =modx_gallery_items.id " ;
$statementt = $modx->query($sqll);
$userss = $statementt->fetchAll(PDO::FETCH_ASSOC);
foreach ($userss as $user) {
    $scr="/assets/gallery/".$user['filename'];
    $name=$user['description'];
print'<div class="mosaicflow__item" style="float:left;padding:20px;"><a class="fancyimage" data-fancybox-group="group" title="'.$name.'" href="'.$scr.'"><img src="'.$scr.'" width="200" height="200" alt="'.$name.'" /></a></div>';
}.

The second question is how to implement the output of the received data from the database so that they are transferred to a certain chunk and then only displayed on the site

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