array:5 [▼
"name" => array:4 [▼
0 => "Koala.jpg"
1 => "Lighthouse.jpg"
2 => "Penguins.jpg"
3 => "Tulips.jpg"
]
"type" => array:4 [▼
0 => "image/jpeg"
1 => "image/jpeg"
2 => "image/jpeg"
3 => "image/jpeg"
]
"tmp_name" => array:4 [▼
0 => "D:\OSPanel\userdata\temp\phpAEAD.tmp"
1 => "D:\OSPanel\userdata\temp\phpAEBE.tmp"
2 => "D:\OSPanel\userdata\temp\phpAEBF.tmp"
3 => "D:\OSPanel\userdata\temp\phpAEFE.tmp"
]
"error" => array:4 [▼
0 => 0
1 => 0
2 => 0
3 => 0
]
"size" => array:4 [▼
0 => 780831
1 => 561276
2 => 777835
3 => 620888
]
]
<code lang="php">
$price_from = $_GET['price_from'];
$price_to = $_GET['price_to'];
$year_from = $_GET['year_from'];
$year_to = $_GET['year_to'];
$engine_from = $_GET['engine_from'];
$engine_to = $_GET['engine_to'];
$sql = '';
if($_GET['brand'] != 1)
{
$brand = $_GET['brand'];
$sql.=" brand = '$brand' and";
}
if($_GET['model_type'] != 2)
{
$model = $_GET['model_type'];
$model = implode("','",$model);
$sql.=" model IN('$model') and";
}
if($_GET['location'] != 3)
{
$location = $_GET['location'];
$sql.=" location = '$location' and";
}
if($_GET['body_type'] != 4)
{
$body_type = $_GET['body_type'];
$body_type = implode("','",$body_type);
$sql.=" body_type IN('$body_type') and";
}
if($_GET['fuel_type'] != 5)
{
$fuel_type = $_GET['fuel_type'];
$fuel_type = implode("','",$fuel_type);
$sql.=" fuel_type IN('$fuel_type') and";
}
$poisks = DB::select("select * from items where $sql year BETWEEN '$year_from' AND '$year_to' && price BETWEEN '$price_from' AND '$price_to' && engine BETWEEN '$engine_from' AND '$engine_to' LIMIT $from_item,$size_page");
</code>
$price_from = $_GET['price_from'];
$price_to = $_GET['price_to'];
$year_from = $_GET['year_from'];
$year_to = $_GET['year_to'];
$engine_from = $_GET['engine_from'];
$engine_to = $_GET['engine_to'];
$sql = '';
if($_GET['brand'] != 1)
{
$brand = $_GET['brand'];
$sql.=" brand = '$brand' and";
}
if($_GET['model_type'] != 2)
{
$model = $_GET['model_type'];
$model = implode("','",$model);
$sql.=" model IN('$model') and";
}
if($_GET['location'] != 3)
{
$location = $_GET['location'];
$sql.=" location = '$location' and";
}
if($_GET['body_type'] != 4)
{
$body_type = $_GET['body_type'];
$body_type = implode("','",$body_type);
$sql.=" body_type IN('$body_type') and";
}
if($_GET['fuel_type'] != 5)
{
$fuel_type = $_GET['fuel_type'];
$fuel_type = implode("','",$fuel_type);
$sql.=" fuel_type IN('$fuel_type') and";
}
$poisks = DB::select("select * from items where $sql year BETWEEN '$year_from' AND '$year_to' && price BETWEEN '$price_from' AND '$price_to' && engine BETWEEN '$engine_from' AND '$engine_to' LIMIT $from_item,$size_page");
". $where ."
вставке в запрос выдаёт это - '$where'
пустой результат.$where = '';
if($_POST['brand']){
$where = 'brand = '.$_POST['brand'];
}
echo $where;
выдаёт - brand = audi и должно в запросе работать