conditional sql statements

Ask a Question related to ASP, Design and Development.

  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. Similar Questions and Discussions

    1. If statements in PHP?
      How do i get something to show only if the user is logged in? For example, "log out" should only show if the user is logged in and "log in" should...
    2. Conditional Statements in CDONTS
      Hi, I have CDONTS working great but have a small problem. There is a question with a checkbox as answer in the form that generates the email. If...
    3. Conditional sum?
      FMP6, MacOSX.2 I've created a calc field using the aggregate Sum(score) to give me a "total points scored" for all related records in a...
    4. "OR" statements allowed in MultipleIf conditional regions in templates?
      Does DMX allow the addition of an "OR" condition on a MultipleIf conditional region: Thus displaying the same output for two different conditions? ...
    5. If/else statements - help.
      Sorry to post so much code all at once but I'm banging my head against the wall trying to get this to work! Does anyone have any idea where I'm...
  3. #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" <billzimmerman@gospellight.com> wrote in message
    news:8da5f4f4.0308291041.251d621e@posting.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

  4. #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" <billzimmerman@gospellight.com> wrote in message
    news:8da5f4f4.0308291041.251d621e@posting.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

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