function getParents($id, $parents=array())
{
if (empty($id)) {
return $parents
} else {
//тут селект запрос, которые выбирает парент айди с базы по $id
$parents[] = $parent_id;
return getParents($parent_id, $parents);
}
}
$id = 4;
$parents = getParents($id);
SELECT t1.id, t2.id, t3.id
FROM sometable as t1
LEFT JOIN somateble as t2 ON t2.id = t1.parent_id
LEFT JOIN somateble as t3 ON t3.id = t2.parent_id
SELECT id, name FROM category WHERE id in (Select parent_category_id FROM category GROUP BY parent_category_id HAVING count(*) <=3)
SELECT category.id, category.name FROM category LEFT JOIN category as ct ON category.id = ct.parent_category_id WHERE ct.parent_category_id is NUll AND category.parent_category_id <> 0
$val['COUNT']=$val['COUNT'] - 1;
$val['COUNT']=$val['COUNT'] + 1;
$arrBasket
не изменяется. Вам нужно или изменить эти записи на такие$arrBasket['basket']['products'][$key]['COUNT']--;
$arrBasket['basket']['products'][$key]['COUNT']++;
foreach($arrBasket['basket']['products'] as $key=>&$val)
$arr[0]->getId();
class Blank {
public function __call($name, $arguments) {
return this;
}
}
$image = imagecreatefromstring(file_get_contents($_FILES['user_image']['tmp_name']));
$exif = exif_read_data($_FILES['user_image']['tmp_name']);
if(!empty($exif['Orientation'])) {
switch($exif['Orientation']) {
case 8:
$image = imagerotate($image,90,0);
break;
case 3:
$image = imagerotate($image,180,0);
break;
case 6:
$image = imagerotate($image,-90,0);
break;
}
}
$file = 'filename.jpeg';
$uploadfile = $uploaddir . $file;
imagejpeg($image,$uploadfile,90);
//
imagedestroy($image);
list($d,$m,$y) = explode('.', $arResult['DISPLAY_ACTIVE_FROM']);
$dateElement = strtotime(implode('-', array('20'.$y,$m,$d)) );
$dateNow = strtotime('now');
if($dateElement < $dateNow) echo "yes";
SELECT
goods.name, SUM(orders.price) as sum
FROM
orders
LEFT JOIN
goods
ON
goods.id = orders.item_id
WHERE
orders.paid = 1
GROUP BY
orders.item_id
$(document).ready(function() {
$(".btn-selector").click(function () {
var imgsrc = $(this).attr('value');
$.ajax({
type: 'get',
url: 'ajax.php',
data: {
'data_item': imgsrc
},
dataType : 'html',
success: function (data) {
$('#result').html(data);
}
});
});
});
<?php echo do_shortcode('[btc]'); ?>
<?php echo get_post_meta($post->ID, 'btc', true); ?>
ini_set('display_errors', 1);
error_reporting(E_ALL);