Created
June 21, 2019 00:17
-
-
Save OlegShchavelev/9f48d76b23a6281b545da0a8a415a863 to your computer and use it in GitHub Desktop.
Выборка телефонов пользователей из списка заказов MS2 MODx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{'phone' | snippet} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$tp = $modx->getOption('table_prefix'); | |
$sQuery = | |
"SELECT u.phone as phone | |
FROM ".$tp."ms2_orders m2o | |
LEFT JOIN ".$tp."ms2_order_addresses u ON (m2o.user_id = u.user_id) | |
GROUP BY m2o.user_id | |
ORDER BY u.phone | |
"; | |
$result = $modx->query($sQuery); | |
$res = $result->fetchAll(PDO::FETCH_ASSOC); | |
echo "<ol>"; | |
foreach($res as $v){ | |
echo "<li>".$v['phone']."</li>"; | |
} | |
echo "</ol>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment