X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 567C653228 for ; Tue, 12 Apr 2005 23:00:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 27608-03 for ; Wed, 13 Apr 2005 02:00:30 +0000 (GMT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id E3B55539B9 for ; Tue, 12 Apr 2005 23:00:29 -0300 (ADT) Received: (qmail 13874 invoked from network); 13 Apr 2005 02:00:34 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 13 Apr 2005 02:00:34 -0000 From: "Greg Sabino Mullane" To: pgsql-interfaces@postgresql.org Subject: Re: How to retrieve how many rows are affected after doing an INSERT statement X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <20050412154124.83434.qmail@web53502.mail.yahoo.com> Date: Wed, 13 Apr 2005 02:00:34 -0000 X-Mailer: JoyMail 1.48 Message-ID: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.266 tagged_above=0 required=5 tests=AWL, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200504/55 X-Sequence-Number: 5471 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > Is there a way to retriever from $dbh how many rows > are affected after doing an insert statement, and how > to present this? You can grab it directly from the execute, or use the rows() method: $sth = $dbh->prepare("INSERT INTO mytable SELECT * FROM mytable"); $count = $sth->execute(); print "Count is $count\n"; $count = $sth->rows; print "Count is still $count\n"; - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200504122200 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iD8DBQFCXH1TvJuQZxSWSsgRAtmzAKDWF3HFWNDl0ITAB/vJkdSSBjW2nACfWqXA vqi47yulZB40WF7w6WuibeQ= =QI53 -----END PGP SIGNATURE-----