in reply to Count Number of rows retrieved from SELECT
$sql = "SELECT count(*) FROM table WHERE name = 'Jamie'"; $sth = $dbh->prepare( $sql ); if ( $sth && $sth->execute() ) { $row = $sth->fetchrow_arrayref(); print( "Returned " . $row->[0] . " row(s)\n" ); } else { print( "Error " . $dbh->errstr() . "\n" ); exit( 1 ); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Count Number of rows retrieved from SELECT
by dtharby (Acolyte) on Jun 13, 2005 at 12:00 UTC | |
by monarch (Priest) on Jun 13, 2005 at 12:13 UTC | |
by dtharby (Acolyte) on Jun 13, 2005 at 13:19 UTC |