-1
I have this condition:
if (date('Y-m-d', strtotime($arrayBancas['dataHora'])) == $data->format('Y-m-d'))
And I also have an array. For each array entry I need to check the condition and show on the screen the position data, and if not, I need to show something with the same space only with the empty items... How could I make a foreach with a parole like that?
What I have so far is this:
while ($arrayBancas = mysql_fetch_array($oBanca->retorno())){
if (date('Y-m-d', strtotime($arrayBancas['dataHora'])) == $data->format('Y-m-d')) {
echo 'Nome:'. $arrayBancas['nome'];
}
}
if (date('Y-m-d', strtotime($arrayBancas['dataHora'])) != $data->format('Y-m-d')) {
echo 'Nome:----------VAZIO--------------';
}
}
This way it works perfectly for a single entry of the true conditional of the first if, but if two or more entries run it, the other does not run for the second or more times, and I need it to happen...
The first
if
is when you have bank data, and the second when you don’t, right? All the records must be in one state or another? I don’t understand why you’re talking aboutforeach
.– Maniero
@Alceu And where is the array What did you say you have? By the code of the question I see that you have lines from a database. You want a lot of empty fields when it’s different day, and a lot of fields filled in when it’s the current date?
– Bacco
And I changed the other question, maybe it’s what you want. This question talks about things that are not present in the code, it’s hard to understand. If it’s something else, you need to explain it better.
– Maniero
Yes! I need several empty fields when the day is different. For each record I need several other empty ones...
– Alceu