if (isset($brand)){if ( !empty($brand) ) {$query = "SELECT * FROM products WHERE brand = '".$_POST["category"]."' ";array(2) {
["a"]=>
string(1) "0"
["b"]=>
string(1) "5"
}$result = [];
$a = (int) $_POST['a'];
$b = (int) $_POST['b'];
$c = array_filter( (array) $_POST['day'] );
if ( !empty($c) )
{
$c = implode(',', $_POST['day']);
$in = str_repeat('?,', count($c) - 1) . '?';
$sql = "SELECT * FROM table WHERE day IN ($in) ASC LIMIT :a, :b";
$stmt = $pdo->prepare($sql);
$stmt->execute($с, [$a, $b]);
$data = $stmt->fetchAll();
$result = $data;
}
echo json_encode($result);<form id="filter">
<input type='hidden' name='a' value='0' />
<input type='hidden' name='b' value='5' />
<input type="checkbox" name="day[]" value="1">
<input type="checkbox" name="day[]" value="2">
<input type="checkbox" name="day[]" value="3">
</form>$.ajax({
url: 'index.php',
method: 'POST',
data: $("#filter").serialize()
}); if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['edit'])) {
$editServiceById = $services->editServiceById($_GET['service_id'], $_POST);
}// Display errors
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// Log values
echo "<pre>";
var_dump($_SERVER['REQUEST_METHOD'], $_POST['edit'], isset($_POST['edit']));
echo "</pre>";
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['edit'])) {
$editServiceById = $services->editServiceById($_GET['service_id'], $_POST);
}/**
* Prepare array for our job
*/
$arrayOne = [
0 => 80,
1 => 80,
2 => 90,
];
$arrayTwo = [
0 => [
0 => 190,
1 => 195,
],
1 => [
0 => 200,
],
2 => [
0 => 190,
1 => 195,
],
];
$arrayThree = [
0 => 1,
1 => 2,
2 => 3,
];
/**
* @var array Array with actual data in our structure
*/
$arResult = [];
foreach ( $arrayTwo as $iKeyOne => $arrayTwoElement )
{
// if in second array exist unknown key
if ( !array_key_exists($iKeyOne, $arrayOne) )
{
continue;
}
// if in third array exist unknown key
if ( !array_key_exists($iKeyOne, $arrayThree) )
{
continue;
}
// if in second array no elements
if ( empty($arrayTwoElement) || !is_array($arrayTwoElement) )
{
continue;
}
/* @var integer Key for first depth level */
$iLevelKey = (int) $arrayOne[ $iKeyOne ];
/* @var integer Value for second depth level */
$iLevelValue = (int) $arrayThree[ $iKeyOne ];
foreach ($arrayTwoElement as $k => $v)
{
$arResult[ $iLevelKey ][ $v ] = $iLevelValue;
}
}
var_dump($arResult);
/*
Will display:
array(2) {
[80]=>
array(3) {
[190]=> int(1)
[195]=> int(1)
[200]=> int(2)
}
[90]=>
array(2) {
[190]=> int(3)
[195]=> int(3)
}
}
*/ Что делать?
Во вкладке SEO, когда меняю пункты META и оставляю галочку на "Изменить для этого раздела и его подразделов", то изменения сохраняются, но они еще сохраняются в подразделов. Мне этого не надо, потому что у каждого подраздела будут свои МЕТА пункты.