Trying to add things to an array , but it has blank spaces

2002-04-03 Thread FLAHERTY, JIM-CONT

Hello, It seams I am sucessfully adding numbers to my array , but in turn
tey are blank spaces. I need Help 

My code 



$dbh =DBI ->connect($data_source, $username, $password) or die "cant connect
to
$data_source : my $dbh-> errstr\n";
my $sth1 = $dbh -> prepare("select num from tests where subject = '$test'
");
$sth1 -> execute or die " unable to execute query ";
#$sth1 -> finish;


   $count1 = 0;
  my $array_ref = $sth1->fetchall_arrayref();

  foreach $row(@$array_ref){

 $num = $row[0];

 push(@numbers, $num);
$count1++;
  }





thanks You 
Jim




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Trying to add things to an array , but it has blank spaces

2002-04-03 Thread bob ackerman

you might trying printing the values to see what you are getting.

print  $row[0];

are you getting as many rows as you expect? check the length of $array_ref
print @$array_ref;

On Wednesday, April 3, 2002, at 06:25  PM, FLAHERTY, JIM-CONT wrote:

> Hello, It seams I am sucessfully adding numbers to my array , but in turn
> tey are blank spaces. I need Help
>
> My code
>
>
>
> $dbh =DBI ->connect($data_source, $username, $password) or die "cant 
> connect
> to
> $data_source : my $dbh-> errstr\n";
> my $sth1 = $dbh -> prepare("select num from tests where subject = '$test'
> ");
> $sth1 -> execute or die " unable to execute query ";
> #$sth1 -> finish;
>
>
>$count1 = 0;
>   my $array_ref = $sth1->fetchall_arrayref();
>
>   foreach $row(@$array_ref){
>
>  $num = $row[0];
>
>  push(@numbers, $num);
> $count1++;
>   }
>
>
>
>
>
> thanks You
> Jim
>
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>



Re: Trying to add things to an array , but it has blank spaces

2002-04-04 Thread Chas Owens

On Wed, 2002-04-03 at 21:25, FLAHERTY, JIM-CONT wrote:
> Hello, It seams I am sucessfully adding numbers to my array , but in turn
> tey are blank spaces. I need Help 
> 
> My code 
> 
> 
> 
> $dbh =DBI ->connect($data_source, $username, $password) or die "cant connect
> to
> $data_source : my $dbh-> errstr\n";
> my $sth1 = $dbh -> prepare("select num from tests where subject = '$test'
> ");
> $sth1 -> execute or die " unable to execute query ";
> #$sth1 -> finish;
> 
> 
>$count1 = 0;
>   my $array_ref = $sth1->fetchall_arrayref();
> 
>   foreach $row(@$array_ref){
> 
>  $num = $row[0];

This should be 

$num = $row->[0];

or

($num) = @$row;

or 

$num = $$row[0];

or any of a hundred different ways to say it.

> 
>  push(@numbers, $num);
> $count1++;
>   }
> 
> 
> 
> 
> 
> thanks You 
> Jim
> 
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
-- 
Today is Prickle-Prickle the 21st day of Discord in the YOLD 3168
Umlaut Zebra über alles!

Missile Address: 33:48:3.521N  84:23:34.786W


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]