SELECT r.id, COUNT(ri.recipe_id) AS count_ingredients
FROM recipes AS r
LEFT JOIN recipes_ingredients AS ri ON r.id = ri.recipe_id
GROUP BY r.id
$('.marker').on('click', function() {
var l = $('.content-list');
var right_margin = parseInt($('.content-list-item').css('margin-right'));
var offset = $('.content-list-item').width() * 4 + right_margin * 4 + right_margin;
var current_offset = parseInt(l.css('margin-left'));
if ($(this).hasClass('enabled')) {
l.css('margin-left', (current_offset + offset) + 'px');
} else {
l.css('margin-left', current_offset - offset + 'px');
}
});
$( this ).html($('.inputhiddenlow').val() +'<br> <span style="font-size:10px;"> узнать больше <span>');
var items = [].slice.call(document.getElementsByClassName('item'));
var wrap_size = 4;
var t_arr = [];
for (var i = 0, j = items.length; i < j; i+= wrap_size) {
t_arr.push(items.slice(i, i + wrap_size));
}
document.getElementById('test').innerHTML = '';
for (i = 0; i < t_arr.length; i++) {
var div = document.createElement('div');
document.getElementById('test').appendChild(div);
for(j = 0; j < t_arr[i].length; j++) {
div.appendChild(t_arr[i][j]);
}
}
eval(xmlhttprequest.responseText);
var scr = document.createElement('script');
document.getElementsByTagName('head')[0].appendChild(scr);
scr.text = xmlhttprequest.responseText;
var arr = [
{'uid': '1', 'parentUid': null},
{'uid': '2', 'parentUid': null},
{'uid': '11', 'parentUid': '1'},
{'uid': '12', 'parentUid': '1'},
{'uid': '21', 'parentUid': '2'},
{'uid': '22', 'parentUid': '2'},
{'uid': '13', 'parentUid': '1'},
{'uid': '23', 'parentUid': '2'},
{'uid': '231', 'parentUid': '23'},
{'uid': '232', 'parentUid': '23'},
{'uid': '111', 'parentUid': '11'},
{'uid': '112', 'parentUid': '11'},
{'uid': '1111', 'parentUid': '111'}
];
arr.sort(function(a,b){
return Number(a['parentUid']) - Number(b['parentUid']);
});
console.log(arr);
function decrypt($value) {
$decrypt = $value / 17;
$p1 = floor($decrypt / 100);
$p2 = $decrypt - 100 * $p1;
$t1 = substr("" + $p1, 1) . '-' . pad($p2, 2);
return $t1;
}
function pad($num, $size) {
$s = $num + "";
while (strlen($s) < $size) {
$s = "0" + $s;
}
return $s;
}
$a1 = 1;
$test_1 = 'test';
var_dump(${"test_" . $a1});