Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: Date Problem

by Anonymous Monk
on Apr 26, 2010 at 09:55 UTC ( #836870=note: print w/replies, xml ) Need Help??

in reply to Re: Date Problem
in thread Date Problem

my $SQL = "Select tran_seq_nbr, sale_amount From KCPOS_Tran_Header Where org_number = $ai_div And store_number = $ai_store And tran_number = $al_trans And terminal_number = $ai_reg And tran_Date = $adt_h_date"; my $sth = $dbh->prepare( $SQL ) or die "Couldn't prepare statement: " . $dbh->errstr; $sth->execute() or die "Couldn't execute statement: " . $sth->errstr; ( $ac_seq_nbr, $ac_sale_amount ) = $sth->fetchrow();

This what i am doing

Replies are listed 'Best First'.
Re^3: Date Problem
by marto (Bishop) on Apr 26, 2010 at 10:59 UTC

    I don't know where you're getting the contents of $adt_h_date, but did you read the section on placeholders from the DBI docs? You want to use placeholders to protect against SQL injection. I'd suggest looking this up in the documentation.

Re^3: Date Problem
by nagalenoj (Friar) on Apr 26, 2010 at 10:36 UTC
    I think the problem is because of not quoting the date value($adt_h_date) in the query preparation.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://836870]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2018-01-20 06:14 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (226 votes). Check out past polls.