Your "DATE" column in the tableABC is a reserved word
and is probably the cause (unless you are on Sybase or
SQL server).
Anyway,
do this at beg of script.
DBI->trace( 2 );
run from cmd line, send the output if you don't get
it.
--- "Ho, Tony" <[EMAIL PROTECTED]> wrote:
> Hi Tim,
> Thanks for the email.
> Unfortunately, I am getting the same results.
> I tried your suggestion and also I tried :
>
> $sth = $dbh->prepare("select
> ITEM_ID,
> START_DATE,
> END_DATE
> from tableABC
> where ACCOUNT = ?
> and SEQ = ?
> and DATE = ?");
> �
> Any ideas ?
> Cheers
> Tony
>
> -----Original Message-----
> From: Tim Harsch [mailto:[EMAIL PROTECTED]]
> Sent: 21 February 2002 18:08
> To: Ho, Tony; 'Jeff Urlwin'; [EMAIL PROTECTED]
> Subject: RE: DBI SQL Query
>
>
> Tony,
> try this:
>
> $sth = $dbh->prepare("select
> ITEM_ID,
> START_DATE,
> END_DATE
> from tableABC
> where ACCOUNT = ?
> and SEQ =
> and DATE = ");
>
> $sth->execute( $account, $seq, $date )
> or die "Unable to execute the SQL Statement
> :
> $DBI::errstr\n";
>
> $sth->bind_columns(\($item, $start_date,
> $end_date));
>
> while($sth->fetchrow_array) {
> some code....
> }
>
>
>
>
> --- "Ho, Tony" <[EMAIL PROTECTED]> wrote:
> > Hi Jeff
> > Thanks for correction.
> > The correct version of the code is as follows :
> >
> > $sth = $dbh->prepare("select
> > ITEM_ID,
> > START_DATE,
> > END_DATE
> > from tableABC
> > where ACCOUNT = $account
> > and SEQ = $seq
> > and DATE = $date");
> >
> > $sth->execute
> > or die "Unable to execute the SQL
> Statement
> > : $DBI::errstr\n";
> >
> > $sth->bind_columns(\($item, $start_date,
> > $end_date));
> >
> > while($sth->fetchrow_array) {
> > some code....
> > }
> >
> > Any ideas to the problem mentioned in the email
> > before despite using the
> > correct version of the code above ?
> >
> > I would be most grateful.
> > Cheers
> > Tony
> >
> > -----Original Message-----
> > From: Jeff Urlwin
> [mailto:[EMAIL PROTECTED]]
> > Sent: 21 February 2002 17:14
> > To: Ho, Tony; [EMAIL PROTECTED]
> > Subject: RE: DBI SQL Query
> >
> >
> > >
> > > Hi guys
> > > I was wondering if you could help me.
> > > I have the following SQL query on command-line
> and
> > I get the
> > > resulting data
> > > :
> > >
> > > 1> select ITEM_ID,START_DATE, END_DATE from
> > tableABC where ACCOUNT = 2435
> > > and
> > > SEQ = 16 and DATE = 19971208
> > > 2> go
> > > ITEM_ID START_DATE
> > END_DATE
> > > ----------------- --------------------
> > ------------------
> > > ABC3M 19940111
>
> > 19991213
> > > ABCBM 19960912
>
> > 19980420
> > > ABCRM 19960912
>
> > 19980420
> > > ABCSM 19960912
>
> > 19980420
> > > ABCUM 19940111
>
> > 19980420
> > > ABCN2 19990930
>
> > 0
> > > ABCEM 19960512
>
> > 0
> > > ABCEP 19990603
>
> > 0
> > > ABCBM 19960912
>
> > 0
> > > UNDIR 19940111
>
> > 0
> > >
> > > (10 rows affected)
> > >
> > > If I put this query into the prepare statement
> of
> > my DBI code as follows :
> > >
> > > $supplementary_services_sth =
> > $dbh->prepare("select
> > >
> > ITEM_ID,
> > >
> > START_DATE,
> > >
> > END_DATE
> > >
> from
> > tableABC
> > >
> where
> > ACCOUNT = $account
> > > and
> > SEQ = $seq
> > > and
> > DATE = $date");
> > >
> > > $sth->execute
> > > or die "Unable to execute the SQL
> > Statement : $DBI::errstr\n";
> > >
> > > $sth->bind_columns(\($item, $start_date,
> > $end_date));
> >
> > This looks like you are binding different data
> than
> > you specify in the query
> > above...
> >
> > >
> > > while($sth->fetchrow_array) {
> > > some code....
> > > }
> > >
> > > After I execute my code, I appear to be
> obtaining
> > only those rows that
> > > END_DATE <> 0
> > > Any ideas why the code is not picking ALL rows ?
> > >
> > > I would be most grateful.
> > > Cheers
> > > Tony
> >
> >
> > Jeff
> >
>
>
> __________________________________________________
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com