0
Basically, I have this foreach to dynamically create the selection text:
foreach ($table['exists'] as $item) {
            switch ($i) {
                case 0:
                    echo($item.' = "'.$_POST[$item].'" AND');
                    break;
                case $len - 1:
                    echo(' '.$item.' = "'.$_POST[$item].'"');
                    break;
                default:
                    echo(' '.$item.' = "'.$_POST[$item].'" AND ');
                    break;
            }
            $i++;
        }
It returns me basically this:
cep = "{CEP inserido}" AND rua = "Delfinópolis" AND dispo = "1"
If this array is inserted into the function (takes the exists array and compares with the one inserted in the form):
$tabela = ['table'  => 'ceps',
                 'exists' => ['cep', 'rua', 'dispo'] ];
I needed to take this dynamically created value and insert it into a variable to put in my function:
$existe = DBRead($table['table'], "WHERE {$minhaVarEntraAqui}");
Concatene, create a variable outside the
foreach, and in every condition ofswitchplace$var = ....– Edilson
@Edilson did not understand this solution. May elaborate a little more the answer?
– Daniel Bonifácio