RiotAct
RiotAct

Reputation: 773

Php mysql table column name conflict

Running into an issue here caused by something beyond my control. I am running a DB query on a table I did not create, it has a table column named "end". This is screwing up my foreach loop as it only gets the first instance and then stops on that particular variable.

Here is my current code:

$eventDates = array();
  foreach( $events as $event ) :
    $eventDates[ $event->post_id ] = $event->start; 
    $eventEnd[ $event->post_id ] = $event->end; 
    $eventVenue[ $event->post_id ] = $event->venue;     
endforeach;

The $event->end; is the problem. Is there another way I can output that data that won't cause a conflict?

Upvotes: 0

Views: 92

Answers (1)

St3an
St3an

Reputation: 806

Try aliasing the column name in the request otherwise.

select end as thisIsTheEnd ...

Upvotes: 2

Related Questions