Derek [ To help the beginners group work, it is best to 'reply-all' so that the group gets the complete interchange. ] I see you have $SQL="SELECT name,extno,dnis,cli,acd FROM avid_call_db..online_stats_table WHERE acd > 0"; # ^^ two dots? $sth = $dbh->prepare($SQL); # prepares the statement in $sth . . # cannot see $sth->execute(); . while ($pointer = $SQL->fetchrow_hashref){ ... # ^^^^ should be $sth?? Comments: I have found hashref doesn't work for named items in a select statement. (I'm open to correction on this: maybe I didn't do it right) You can do $SQL='SELECT * FROM ...'; $sth=$dbh->prepare($SQL); $sth->execute(); while ($pointer=$sth->fetchrow_hashref){... or $SQL="SELECT name,extno,dnis,cli,acd FROM ... $sth=$dbh->prepare($SQL); $sth->execute(); while (my $arrayref=$sth->fetchrow_arrayref){ my ($name,$extno,$dnis,$cli,$acd)=@$arrayref; . . . } May I recommend you acquire ActivePerl from www.activestate.com: even if you don't use it, the documentation is an excellent ready reference. (If the module doesn't seem to be documented, download it from CPAN (using PPM or otherwise). I trust this helps a bit. - Roger - ----- Original Message ----- From: "Derek Harding" <[EMAIL PROTECTED]> To: "Roger C Haslock" <[EMAIL PROTECTED]> Sent: Wednesday, June 13, 2001 3:03 PM Subject: Thanks > Hi Roger, > > Thanks indeed for coming back so promptly, it's only taken me all this time > to create the reply! > > Essentially, someone else wrote a script but it doesn't work and I don't know > perl properly yet. > > What I need is that part of the script which puts the SELECT data into an > array and then prints the array in the appropriate line at a time which can > then be "print"ed into an html page. I assume one uses fetchrow_array but I'm > at a bit of a loss about that at present. The test scripts that came with the > NT Perl install DIDN'T use the DBI::Connect but this is the script he wrote > (or the connect bit with the real field names) > > use DBI; > ## $DSN = "DBI:sqlsvr:AVID SQL SERVER"; > $DSN = "DBI:sqlsvr:NTAVID"; > $user = "avid"; > $password= ""; > $dbh = DBI->connect($DSN,$user,$password) > || die "Cannot connect: $DBI::errstr\n" unless $dbh; > return; > > This is the select bit (wot I rote) and the execute bit which he did. > > $SQL="SELECT name,extno,dnis,cli,acd FROM avid_call_db..online_stats_table > WHERE acd > 0"; > eval{$sth = $dbh->prepare($SQL)}; > > and this is the allocation bit which he did:- > > while ($pointer = $SQL->fetchrow_hashref){ > $Name = $pointer->{'name'}; > $Extno = $pointer->{'extno'}; > $Dnis = $pointer->{'dnis'}; > $Cli = $pointer->{'cli'}; > $Acd = $pointer->{'acd'}; > } > > > I know I've left some of it out (it was written as several routines) but I > think this gives the gist. > > -- > Best wishes, > Derek Harding, (BA MIAP) > ICT & Network Manager > [EMAIL PROTECTED] > > >