Hello All --
I am currently using an open source piece of calendar software. This software inserts calendar entries into MYSQL based on an array of room id values like so:
I want to change the value of a variable within the foreach loop if one of the $rooms array elements equals a certain number. This variable would then be used as part of my insert.PHP Code:foreach ( $rooms as $room_id ) {
insert into calendar_entrues values ...
}
For example, I tried something like this:
This code chugs right past my if statement and inputs 0 for each $hidden even when my $rooms = 22 is present.PHP Code:foreach ( $rooms as $room_id ) {
if ($rooms == "22") {
$hidden = 1;
}
else {
$hidden = 0
}
insert into calendar_entries values ($hidden...)
}
So I'm thinking I'm looking for the correct syntax to check if each array element equals a certain value. If it is, then set $hidden to one value, if not, set it to something else.
Can anyone help me out?
Thanks in advance!
-- Chris




Bookmarks