...
require_once($_SERVER['DOCUMENT_ROOT'].'\Extension\phpexcel\PHPExcel\IOFactory.php');
$excel = \PHPExcel_IOFactory::load("$temp_dir/$file");
$arr = $excel->getActiveSheet()->toArray(null,true,true,true);
foreach ($arr as $key => $value) {
$tab_num = $value["B"];
...
SELECT * FROM `table` WHERE `id` >= 76 AND `id` <= 936 AND`date` >= '2018-01-10' AND `date` <= '2018-02-01'
#или
SELECT * FROM `table` WHERE `date` BETWEEN '2018-09-10' AND '2018-11-10'
#или
SELECT * FROM `table` WHERE `date` IN ( '2018-09-10', '2018-11-10', '2018-10-10' )
SELECT DATE_FORMAT(`date`,"%d.%m.%Y") AS `date` FROM `table` WHERE id=1
#Первая половина месяца
SELECT *
FROM `table `
WHERE
MONTH(date) = MONTH(NOW())
AND
YEAR(date) = YEAR(NOW())
AND
DAY(date) <= 15
ORDER BY date;
#Вторая половина месяца
SELECT *
FROM `table `
WHERE
MONTH(date) = MONTH(NOW())
AND YEAR(date) = YEAR(NOW())
AND
DAY(date) > 15
ORDER BY date;
SELECT DISTINCT `tagRelation`.tagId
FROM `model`
INNER JOIN `tagRelation` ON `tagRelation`.`modelId` = `model`.id
WHERE 1
SELECT DISTINCT `tagRelation`.tagId
FROM `model`
INNER JOIN `tagRelation` ON `tagRelation`.`modelId` = `model`.id
WHERE `tagRelation`.`tagId` IN (1, 2, 3)
<?php
// Получение сплошного списка
function get_cat()
{
global $pdo;
$cat_arr = [];
try
{
$query = "SELECT ID, PID, NAME FROM `catalog` WHERE 1";
$stmt = $pdo->prepare( $query );
$stmt->execute();
}
catch (PDOException $e)
{
die("Error in :".__FILE__." file, at ".__LINE__." line. Can't get data : " . $e->getMessage());
}
while( $row = $stmt->fetch(PDO::FETCH_ASSOC ) )
$cat_arr[$row['ID']] = $row;
return $cat_arr;
}
// Построение дерева
function tree_map( $dataset )
{
$tree = [];
foreach ($dataset as $id=>&$node)
if (!$node['PID'])
$tree[$id] = &$node;
else
$dataset[$node['PID']]['childs'][$id] = &$node;
return $tree;
}
$dataset = get_cat();
$dataset = tree_map( $dataset );
<?php
function debug( $arr )
{
$str = print_r($arr, true);
echo '<pre>'.$str.'</pre>';
}
<?php
$id = []
$id[] = '1';
$id[] = '2';
$id[] = '3';
$id[] = '4';
$posts = R::findOne('posts', 'id', $id );
echo $posts->head, '<br>';
echo $posts->desc;
<?php
$posts = R::findOne('posts', 'id', [ '1', '2', '3', '4' ] );
или
$posts = R::findOne('posts', 'id', [ 1, 2, 3, 4 ] );
echo $posts->head, '<br>';
echo $posts->desc;
SELECT id,
(
SELECT items_info.PRICE FROM items
LEFT JOIN items_info ON items_info.id = items.item_id
WHERE items.id = JSON_EXTRACT(commission_items,'$[0]')
) AS price
FROM `bet_games`
WHERE 1
SELECT items_info.id, items_info.price FROM items
LEFT JOIN items_info ON items_info.id = items.item_id
WHERE
items.id IN
(
SELECT JSON_EXTRACT(`commission_items`,'$[0]')
FROM `bet_games`
)