SQL Update help - OsCommerce related

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MattMika

    SQL Update help - OsCommerce related

    I am trying to integrate a Credit Card # deletion option into
    Batch_print_cen ter and need some help.

    Batch_print_cen ter has a form where you specify orders you want to
    print or proccess by either entering in a range(ie, 3-9), a comma
    separated list(ie, 3,4,5,6) or a range by start and end date(ie,
    yyyy-MM-dd - yyyy-MM-dd)which is a javascript calendar widget.
    Date_purchased is stored in the DB as 2005-04-12 13:19:13.

    This first condition works if a range or comma separated list is
    given, but the second start/end date range does not. I believe the
    time stamp is not being added successfully.

    // Clear Credit Card
    if(($HTTP_POST_ VARS['clear_CC'] == 'on') && ($invoicenumber s != '')) {
    tep_db_query("u pdate " . TABLE_ORDERS . " set cc_number = ''
    where orders_id in (" . tep_db_input($i nvoicenumbers) . ") ");
    } elseif (($HTTP_POST_VA RS['clear_CC'] == 'on') &&
    (isset($HTTP_PO ST_VARS['startdate'])) &&
    (!isset($HTTP_P OST_VARS['enddate']))) {
    tep_db_query("u pdate " . TABLE_ORDERS . " set cc_number = '' where
    date_purchased between '" . $HTTP_POST_VARS['startdate'] . "' and '" .
    $HTTP_POST_VARS['enddate'] . "23:59:59") ;
    }
    //

    Any ideas?
    TIA
    "These animals evacuate ethyl alcohol from their bowels and carbon dioxide from their urinary organs. Thus, one can observe how a specially lighter fluid is exuded from the anus and rises vertically whereas a stream of carbon dioxide is ejected at very short intervals from enormously long genitales."

    Justus Freiherr von Liebig - 1839
  • MattMika

    #2
    Re: SQL Update help - OsCommerce related

    Obviously no one cares and/or knew, but I figured out my problem.
    Initially I had an errant ! that I didnt see which made the elseif
    condition never true. Then there was a syntax problem when the query
    encountered the colons. A few odd single quotes Here's the working
    code:

    // Clear Credit Card
    if(($HTTP_POST_ VARS['clear_CC'] == 'on') && ($invoicenumber s != '')) {
    tep_db_query("u pdate " . TABLE_ORDERS . " set cc_number = ''
    where orders_id in (" . tep_db_input($i nvoicenumbers) . ") ");
    } elseif (($HTTP_POST_VA RS['clear_CC'] == 'on') &&
    (isset($HTTP_PO ST_VARS['startdate'])) &&
    (isset($HTTP_PO ST_VARS['enddate']))) {
    tep_db_query("u pdate " . TABLE_ORDERS . " set cc_number = '' where
    date_purchased between '" . tep_db_input($s tartdate) . "' and '" .
    tep_db_input($e nddate) . "23:59:59'" );
    }
    //

    On Wed, 13 Apr 2005 14:22:04 -0600, MattMika
    <rotaourATdimco mDEEOHTEEnet> wrote:
    [color=blue]
    >I am trying to integrate a Credit Card # deletion option into
    >Batch_print_ce nter and need some help.
    >
    >Batch_print_ce nter has a form where you specify orders you want to
    >print or proccess by either entering in a range(ie, 3-9), a comma
    >separated list(ie, 3,4,5,6) or a range by start and end date(ie,
    >yyyy-MM-dd - yyyy-MM-dd)which is a javascript calendar widget.
    >Date_purchas ed is stored in the DB as 2005-04-12 13:19:13.
    >
    >This first condition works if a range or comma separated list is
    >given, but the second start/end date range does not. I believe the
    >time stamp is not being added successfully.
    >
    >// Clear Credit Card
    >if(($HTTP_POST _VARS['clear_CC'] == 'on') && ($invoicenumber s != '')) {
    > tep_db_query("u pdate " . TABLE_ORDERS . " set cc_number = ''
    >where orders_id in (" . tep_db_input($i nvoicenumbers) . ") ");
    >} elseif (($HTTP_POST_VA RS['clear_CC'] == 'on') &&
    >(isset($HTTP_P OST_VARS['startdate'])) &&
    >(!isset($HTTP_ POST_VARS['enddate']))) {
    >tep_db_query(" update " . TABLE_ORDERS . " set cc_number = '' where
    >date_purchas ed between '" . $HTTP_POST_VARS['startdate'] . "' and '" .
    >$HTTP_POST_VAR S['enddate'] . "23:59:59") ;
    >}
    >//
    >
    >Any ideas?
    >TIA
    >"These animals evacuate ethyl alcohol from their bowels and carbon dioxide from their urinary organs. Thus, one can observe how a specially lighter fluid is exuded from the anus and rises vertically whereas a stream of carbon dioxide is ejected at very short intervals from enormously long genitales."
    >
    >Justus Freiherr von Liebig - 1839[/color]

    "These animals evacuate ethyl alcohol from their bowels and carbon dioxide from their urinary organs. Thus, one can observe how a specially lighter fluid is exuded from the anus and rises vertically whereas a stream of carbon dioxide is ejected at very short intervals from enormously long genitales."

    Justus Freiherr von Liebig - 1839

    Comment

    Working...