Well that's because you only fetched one row. fetchrow is deprecated and
replaced by fetchrow_array()
How about trying this...
while (@array = $query->fetchrow_array())
{
foreach (@array)
{
print $_, " | ";
}
print "\n";
}
Ilya Sterin
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 4:27 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Postgres select problem
Dear,
I am 2 differents output from psql and use Postgres
% su - postgres
% psql hrdb
hrdb=> select * from employee where middlename like '%LAMINE%';
MAMADOU | LAMINE | DIATTA | SYSTEM ENGINEE | [EMAIL PROTECTED]|
677-4417985 |780-393-3675 |403-915-7162 |407-915-7162 |SOCCER, BIKING|
05-29-2001
AFANA | LAMINE | KA | SYSTEM ENGINEER | [EMAIL PROTECTED] |
679-4417985 |670-393-3675 |604-915-7162 |604-915-7162 |SOCCER, BIKING|
05-29-2001
(2 rows)
And the folling command in a perl program using the same database and
use Postgres gives me the first record only
my $select_statement = "select * from employee where middlename like
'%LAMINE%'\;";
$query = $dbh->execute("$select_statement") or die "Error :
$Postgres::error\n";
@array = $query->fetchrow();
print "size of array = $#array\n";
for $i (0 .. $#array) {
print "$array[$i]\n";
}
This array has only the first 11 records concerning entries of MAMADOU, but
never print out second record concerning entries of AFANA.
Can you help debug this. Thank you !
--------------------------------------------------------------------
Mail2Web - Check your email from the web at
http://www.mail2web.com/ .