Professional Web Applications Themes

conditional sql statements - ASP

I have a shopping cart that I want to load items in that come from a huge scrolling form. In other words, when someone clicks on a category in our site, it scrolls out all the items in that category, maybe 30 or more. I have text boxes next to each item so somone can enter a number, then press submit form button at the bottom of the form, and send those slections to the shopping cart. The problem is, many of the text boxes are empty, yet they are still being sent to the shopping cart as a quatity ...

  1. #1

    Default conditional sql statements

    I have a shopping cart that I want to load items in that come from a
    huge scrolling form. In other words, when someone clicks on a category
    in our site, it scrolls out all the items in that category, maybe 30
    or more. I have text boxes next to each item so somone can enter a
    number, then press submit form button at the bottom of the form, and
    send those slections to the shopping cart.

    The problem is, many of the text boxes are empty, yet they are still
    being sent to the shopping cart as a quatity of 0. Is there a way for
    sql to ignore a value if the variable is zero, or only get the sql
    statement to run if a variable is > 0?

    Thanks,

    Bill
    Bill Guest

  2. #2

    Default Re: conditional sql statements

    Post your code. [empty] <> 0 unless you cint() it, or unless in your DB,
    you have a default value of 0. I don't know how your building your query,
    but it sounds like you may want to change it so that it only inserts values
    for columns that values were sent for from your form.

    Ray at work

    "Bill" <billzimmermangospellight.com> wrote in message
    news:8da5f4f4.0308291041.251d621eposting.google.c om...
    > I have a shopping cart that I want to load items in that come from a
    > huge scrolling form. In other words, when someone clicks on a category
    > in our site, it scrolls out all the items in that category, maybe 30
    > or more. I have text boxes next to each item so somone can enter a
    > number, then press submit form button at the bottom of the form, and
    > send those slections to the shopping cart.
    >
    > The problem is, many of the text boxes are empty, yet they are still
    > being sent to the shopping cart as a quatity of 0. Is there a way for
    > sql to ignore a value if the variable is zero, or only get the sql
    > statement to run if a variable is > 0?
    >
    > Thanks,
    >
    > Bill

    Ray at Guest

  3. #3

    Default Re: conditional sql statements

    I would recommend checking the fields in the submitted form for "" (or "0"),
    and construct a sql query on the fly that you call at the end.

    "Bill" <billzimmermangospellight.com> wrote in message
    news:8da5f4f4.0308291041.251d621eposting.google.c om...
    > I have a shopping cart that I want to load items in that come from a
    > huge scrolling form. In other words, when someone clicks on a category
    > in our site, it scrolls out all the items in that category, maybe 30
    > or more. I have text boxes next to each item so somone can enter a
    > number, then press submit form button at the bottom of the form, and
    > send those slections to the shopping cart.
    >
    > The problem is, many of the text boxes are empty, yet they are still
    > being sent to the shopping cart as a quatity of 0. Is there a way for
    > sql to ignore a value if the variable is zero, or only get the sql
    > statement to run if a variable is > 0?
    >
    > Thanks,
    >
    > Bill

    Mike Florio Guest

Similar Threads

  1. If Statements????
    By ccarterca in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: October 17th, 12:34 PM
  2. Conditional Statements in CDONTS
    By Mintyman in forum Dreamweaver AppDev
    Replies: 4
    Last Post: February 17th, 02:32 PM
  3. Conditional sum?
    By Fred in forum FileMaker
    Replies: 2
    Last Post: October 28th, 04:16 PM
  4. "OR" statements allowed in MultipleIf conditional regions in templates?
    By GGirlando webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 8
    Last Post: July 28th, 06:01 PM
  5. If/else statements - help.
    By Chris in forum PHP Development
    Replies: 1
    Last Post: June 28th, 01:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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