Adding and Deleting fields in my media DB

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Adding and Deleting fields in my media DB

    Now I am ready for help in another aspect of my media pages. I currently have
    pages that give details on books or dvds. When a visitor wants to borrow a
    book or dvd, they submit a form that updates my db with their name in a
    particular field and then it sends me an email. I want to add a check in the
    onLoanFlag checkbox field and the date requested in the onLoanDate field
    automatically. Once the book has been returned I want to be able to remove
    these items from the fields without going directly into the db (probably a new
    cfm page). Here is the code to get the requestorName in the db: <cfquery
    name='UpdateDVD' datasource='media'> UPDATE DVDS SET
    onLoanName='#Form.onLoanName#' SET RequestorName='#Form.requestorName#' WHERE
    MovieTitle = '#Form.MovieTitle#' </cfquery> <html> <head> <title>DVD Request
    Confirmation</title> </head> <body background='images/BGDVD4.gif'> <font
    color='ffffcc' face='Geneva, Arial, Helvetica, sans-serif'> </font> <cfoutput>
    <h1> <font color='##000000' face='Geneva, Arial, Helvetica, sans-serif'> Thank
    you #Form.requestorName#. Your request for #Form.MovieTitle# has been sent to
    Cori! </font> </h1> <p> <font color='##000000' size='5' face='Geneva, Arial,
    Helvetica, sans-serif'> The next time you get together, Cori will have the
    requested movies pulled and ready to go. </font> </p> </cfoutput> <font
    color='ffffcc'> <cfprocessingdirective suppresswhitespace='no'> <cfmail
    subject='DVD Request' from='cgacfox@comcast.net' to='cgacfox@comcast.net' >
    The requested movie is: Movie: #Form.movietitle# Requested by:
    #Form.requestorName# </cfmail> </cfprocessingdirective> </font> </body>
    </html> I know it is not as easy as SETting these fields since they are not
    text fields. Any suggestions on how to accomplish this?

    cgacfox Guest

  2. Similar Questions and Discussions

    1. Adding, deleting images - Acrobat 6 Professional
      Apologies in advance if this has been broached before - could not find the exact answer in the FAQs or KB search. 2 scenarios (running AB6 Pro...
    2. Adding and Deleting a column in SQL
      Hi I was wondering how I could remove, or add, a column using SQL in my ASP page, as well as a sample of the code Thanks -Dany
    3. [PHP] Deleting array fields...
      * Thus wrote Jason Giangrande (jason@giangrande.org): unset($array); I don't think it rearranges it. perhaps the docs should mention this in...
    4. Deleting array fields...
      Is there a way to delete array fields without resort the keys? The keys of this particular array are the position of the words it holds to their...
    5. Deleting fields
      A long time ago (on this forum I believe), there was a discussion on deleting fields. It was advised never to delete fields in an established...
  3. #2

    Default Re: Adding and Deleting fields in my media DB

    I am still struggling with this code. Every time I try to change something I
    get this error: Element ONLOANFLAG is undefined in FORM. The error
    occurred in C:\websites\kj2ugz\Securitypages\DVDconfirm.cfm: line 5 3 :
    <cfquery name='UpdateDVD' datasource='media'> 4 : UPDATE DVDS 5 : SET
    onLoanFlag='#Form.onLoanFlag#' 6 : SET onLoanDate='#Form.onLoanDate#' 7 : SET
    onLoanName='#Form.onLoanName#' I want these fields updated in my db when the
    person requests a particular movie. The requestorName field populates just
    fine. The other fields do not. I realize that a checkbox and a date field
    require some tweaking but I am not sure exactly how to do this. Please help!

    cgacfox Guest

  4. #3

    Default Re: Adding and Deleting fields in my media DB

    How about only using SET once, and put a comma between the fields that you are
    updating....

    <cfquery name="UpdateDVD" datasource="media">
    UPDATE DVDS
    SET onLoanName='#Form.onLoanName#',
    RequestorName='#Form.requestorName#'
    WHERE MovieTitle = '#Form.MovieTitle#'
    </cfquery>

    Phil

    paross1 Guest

  5. #4

    Default Re: Adding and Deleting fields in my media DB

    I tried this and am still getting an error: Element ONLOANFLAG is undefined in
    FORM. The error occurred in
    C:\websites\kj2ugz\Securitypages\DVDconfirm.cfm: line 5 3 : <cfquery
    name='UpdateDVD' datasource='media'> 4 : UPDATE DVDS 5 : SET
    onLoanFlag='#Form.onLoanFlag#', 6 : onLoanDate='#Form.onLoanDate#', 7 :
    onLoanName='#Form.onLoanName#' I have to define the checkbox for onLoanFlag
    and the field for the onLoanDate in date format. This is what I am not sure how
    to do.

    cgacfox Guest

  6. #5

    Default Re: Adding and Deleting fields in my media DB

    Well, where are you setting the value of Form.onLoanFlag before submitting the form to your action page (or any of the other form variables for that matter)?

    Phil
    paross1 Guest

  7. #6

    Default Re: Adding and Deleting fields in my media DB

    I thought about what you said last night and realized that the page that posts
    the info does not have those fields in it. The visitor just enters their name
    in a text box and it sends the info to the db. It wouldn't look good to have
    the check box for onLoanFlag and the text box for onLoanDate on that page to be
    filled out by the visitor. I do have a DVDMaint page where I can add these two
    items once I see that someone has requested a dvd. I can also remove these
    items when the dvd is returned. I was just looking for an easier way to do
    this. I think I will stick with what I have for now. I do thank you for your
    help and opening my eyes to how this works in the background. I wasn't thinking
    it all the way through.

    cgacfox Guest

  8. #7

    Default Re: Adding and Deleting fields in my media DB

    <input type=hidden> is a trick to pass fields back to youself via a form without letting users see or modify content.
    JMGibson3 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139