Prepared Statements Rows Selected

Prepared Statements Rows Selected

am 24.05.2011 00:53:14 von ron.piggott

------=_NextPart_000_007A_01CC197A.ABFF94E0
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: quoted-printable


What command will tell me the # of rows the SELECT query retrieved using =
Prepared Statements.


$dsh =3D 'mysql:host=3Dlocalhost;dbname=3D'.$database;
$dbh =3D new PDO($dsh, $username, $password);

$stmt =3D $dbh->prepare($query);

$stmt->bindParam(':email', $email);
$stmt->bindParam(':pass', $pass);

$stmt->execute();


I am looking for the equivalent of mysql_numrows

mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$result=3Dmysql_query($query);
$num=3Dmysql_numrows($result);


Ron

The Verse of the Day
â€=9CEncouragement from Godâ€=99s Wordâ€=9D
http://www.TheVerseOfTheDay.info =20

------=_NextPart_000_007A_01CC197A.ABFF94E0--

Re: Prepared Statements Rows Selected

am 24.05.2011 04:04:39 von Giff Hammar

$stmt->rows() should give you the number of rows returned.

Giff

On Mon, 2011-05-23 at 18:53 -0400, Ron Piggott wrote:
> What command will tell me the # of rows the SELECT query retrieved using =
Prepared Statements.
>=20
>=20
> $dsh =3D 'mysql:host=3Dlocalhost;dbname=3D'.$database;
> $dbh =3D new PDO($dsh, $username, $password);
>=20
> $stmt =3D $dbh->prepare($query);
>=20
> $stmt->bindParam(':email', $email);
> $stmt->bindParam(':pass', $pass);
>=20
> $stmt->execute();
>=20
>=20
> I am looking for the equivalent of mysql_numrows
>=20
> mysql_connect('localhost',$username,$password);
> @mysql_select_db($database) or die( "Unable to select database");
> $result=3Dmysql_query($query);
> $num=3Dmysql_numrows($result);
>=20
>=20
> Ron
>=20
> The Verse of the Day
> â€=9CEncouragement from Godâ€=99s Wordâ€=9D
> http://www.TheVerseOfTheDay.info =20



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php