This doesn't make the slightest bit of sense to me, but hopefully someone will know what forces are behind this sorcery:
A MySQL query that I'm running through PHP is returning different results than when I place that exact same query directly into phpMyAdmin (which is returning the correct results). The difference is that through my PHP script rows where availabledoes not actually equal '1' are being included and when I print the results for some reason in that row it thinks the value of available is '1' (but it's actually 0).
SELECT DISTINCT(event_seat_id), seat, row, event_section_id, available
FROM events_seats LEFT JOIN venues_seats
ON events_seats.seat_id=venues_seats.seat_id
LEFT JOIN events_sections
ON events_seats.event_section_id=events_sections.arbitrary_id
WHERE events_seats.event_id=$event_id
AND events_seats.available=1
AND venues_seats.seat IS NOT NULL
ORDER BY events_sections.rank ASC, venues_seats.row ASC, venues_seats.seat ASC
Using PHP (note that the value of [available] is actually 0 and not 1 like it is being returned)
[0] => Array
(
[0] => 183
[event_seat_id] => 183
[1] => 1
[seat] => 1
[2] => A
[row] => A
[3] => 21
[event_section_id] => 21
[4] => 1
[available] => 1 (not actually 1)
)
[1] => Array
(
[0] => 184
[event_seat_id] => 184
[1] => 2
[seat] => 2
[2] => A
[row] => A
[3] => 21
[event_section_id] => 21
[4] => 1
[available] => 1 [COLOR="Lime"][B] (not actually 1)[/B][/COLOR]
)
[2] => Array
(
[0] => 185
[event_seat_id] => 185
[1] => 3
[seat] => 3
[2] => A
[row] => A
[3] => 21
[event_section_id] => 21
[4] => 1
[available] => 1 [COLOR="Lime"][B] (not actually 1)[/B][/COLOR]
)
[3] => Array
(
[0] => 187
[event_seat_id] => 187
[1] => 5
[seat] => 5
[2] => A
[row] => A
[3] => 21
[event_section_id] => 21
[4] => 1
[available] => 1
)
[4] => Array
(
[0] => 188
[event_seat_id] => 188
[1] => 6
[seat] => 6
[2] => A
[row] => A
[3] => 21
[event_section_id] => 21
[4] => 1
[available] => 1
)
[5] => Array
(
[0] => 189
[event_seat_id] => 189
[1] => 7
[seat] => 7
[2] => A
[row] => A
[3] => 21
[event_section_id] => 21
[4] => 1
[available] => 1
)
phpMyAdmin (note that the above 3 incorrect rows were not returned below because phpMyAdmin is correctly interpreting the query)
event_seat_id seat row event_section_id available
187 5 A 21 1
188 6 A 21 1
189 7 A 21 1