I need little help. Please how can I get the PHP value "$filtr_zamestnanci_ID" to the sql_query. Code here :
<?php
if (isset($_POST["filtr_zamestnanci_ID"])) {
for ($a = 0; $a < count($_POST["filtr_zamestnanci_ID"]); $a++) {
$filtr_zamestnanci_ID .="AND companies_text_records_user_ID = '".$_POST["filtr_zamestnanci_ID"][$a]."' ";
}
}else {
$filtr_zamestnanci_ID = "";
}
echo "filtr_zamestnanci_ID :".$filtr_zamestnanci_ID;
mysql_query("SET CHARACTER SET utf8");
$sql_1 =
mysql_query("SELECT * FROM companies_text_records
LEFT JOIN companies ON companies_text_records_company_ID = company_ID
LEFT JOIN login_users ON user_id = companies_text_records_user_ID
WHERE companies_text_records_relative_to = '0'
'".$filtr_zamestnanci_ID."'
ORDER BY companies_text_records_ID DESC");
?>
If I pass it without loop everything is OK. But output from loop don´t work at all. Maybe something in the formatting of "$filtr_zamestnanci_ID" ?