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 basically returns this to me:
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 get this dynamically created value and insert into a variable to by in my function:
$existe = DBRead($table['table'], "WHERE {$minhaVarEntraAqui}");