Skip to main content
Known Participant
February 12, 2007
Question

Insert several dates for the same event

  • February 12, 2007
  • 17 replies
  • 1403 views
Hey guys,

I have two tables joined. 1 with dates and venue, the other with speakers.

How can I add more dates to the same speaker during his programme of appearance. i.e. Speaker A will be appearing for the following dates: 20/02/2007 - 27/02/2007 & 5/03/2007.....

I was thinking of a Date fiels and a dropdown dynamic field. But I'm having problems figuring it out...

Any help would be very much appreciated..

Thanks
    This topic has been closed for replies.

    17 replies

    Inspiring
    February 15, 2007
    all little bugs in your code aside (i.e. unnecessary ##, pulling fields from db that are not used anywhere, etc), i am not clear on which field the speaker description is stored in in your db? is it in review.review? you are not displaying that data anywhere in the form, anyway....

    also, in your original (first) post you mentioned 2 tables: speakers and venues... but in your rsInsert query you are joining speakers and review... is this a different issue then?
    Inspiring
    February 15, 2007
    <cfoutput query="rsInsert">
    <option value="#rsInsert.speakerID#">#rsInsert.speakerName# -- #rsInsert.speaker.eventDate#</option>
    </cfoutput>
    </select>

    would give the .evenDate that was with each record pulled...

    - Mike
    Bob-ElAuthor
    Known Participant
    February 15, 2007
    Thanks Sabaidee,

    Please find below the whole code:

    <cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
    <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ

    "insert">
    <cfquery datasource="utcg302">
    INSERT INTO speaker (speakerName, venue, eventDate)
    VALUES (
    <cfif IsDefined("FORM.speaker") AND #FORM.speaker# NEQ "">
    <cfqueryparam value="#FORM.speaker#" cfsqltype="cf_sql_clob"

    maxlength="150">
    <cfelse>
    ''
    </cfif>
    ,
    <cfif IsDefined("FORM.Venue") AND #FORM.Venue# NEQ "">
    <cfqueryparam value="#FORM.Venue#" cfsqltype="cf_sql_clob"

    maxlength="50">
    <cfelse>
    ''
    </cfif>
    ,
    <cfif IsDefined("FORM.date") AND #FORM.date# NEQ "">
    <cfqueryparam value="#FORM.date#" cfsqltype="cf_sql_timestamp">
    <cfelse>
    NULL
    </cfif>
    )
    </cfquery>
    </cfif>

    ------------------------------------------------

    <cfquery name="rsInsert" datasource="utcg300">
    SELECT speaker.speakerID, speaker.speakerName, speaker.venue,

    speaker.eventDate, review.reviewID, review.review
    FROM speaker INNER JOIN review ON speaker.actID = review.actID
    ORDER BY speaker.eventDate
    </cfquery>

    ----------------------------------------------------


    <form action="<cfoutput>#CurrentPage#</cfoutput>" id="insert" name="insert"

    method="POST">
    <label for="textfield">Date</label>
    <p>
    <input name="date" type="text" id="date" />
    </p>
    <table width="200">
    <tr>
    <td><label>
    <input type="radio" name="Venue" value="Stoney" />
    Stoney</label></td>
    </tr>
    <tr>
    <td><label>
    <input type="radio" name="Venue" value="William Edwards" />
    William Edwards</label></td>
    </tr>
    </table>
    <p> </p>
    <p>
    <label for="select">speaker</label>
    <select name="speaker" id="Speaker">
    <option value="">Choose One</option>
    <option value=""></option><cfoutput query="rsInsert">
    <option value="#rsInsert.speakerID#">#rsInsert.speakerName#</option>
    </cfoutput>
    </select>

    <p>
    <label for="Submit"></label>
    <input type="submit" name="Submit" value="Submit" id="Submit" />
    </p>

    <input type="hidden" name="MM_InsertRecord" value="insert">
    </form>
    Inspiring
    February 15, 2007
    post your query. hard to say without seeing it...
    Bob-ElAuthor
    Known Participant
    February 15, 2007
    Please excuse me, my mind is all over the places at the moment.

    What I failed to explain (or add) is that each Speaker has a description about themselves. Joining the two tables on SpeakerID shows the dates, but doesn't bring the description over with it..

    I'm missing something in the form, but don't know what.

    Many thanks
    Inspiring
    February 13, 2007
    So if you join your two tables on speakerID, you should be in business.
    Inspiring
    February 13, 2007
    What's a dynamic dropdown field?
    Bob-ElAuthor
    Known Participant
    February 13, 2007
    Hi Dan,

    The drop down menu is pulling the Speakers name from the Speakers table in the database, which is related to the venue via a foreign key.
    Basically, I have an access database with 2 tables, Speakers and Venue. There is a speakerID & speakerName in the Speaker table. & venueID, eventDate & speakerID in the venue table..

    Hope this makes sense..

    Many thanks