I have two tables that I would like to work together (stories and events). Stories is a table that is used to produce articles on a website and events is a series of events put into a table. I would like to be able to add events to story based on the data in the story table.
Each story in stories has a unique Story_Code and also has fields like events1, events2, events3, events4 etc.
Each event in events has a unique Event_Code.
I would like to be able to have the user when posting a story in the stories table to be able to enter the Event_Code and that would pull in the data from the events table, but I am at a loss as to how to do it.
Currently, I can pull them based on the date as follows:
("SELECT * FROM events where Date = '2014-11-22' order by Icon ASC, Date DESC, Timestamp DESC")
What I want to do is change the where clause to fetch the event_codes specified by the user in the story table by story_code.
I think I need to define a variable for events1, events2 etc and then once it is defined, I can use that in my where clause.
Any help would be appreciated...