Php Code To Get Count Of Rows In Pdo Result Using Mysql Database
________________________________________________________
I Use In This Tutorial:
- NetBeans IDE .
- XAMPP .
- PhpMyAdmin .
In this Php Tutorial we will see How To Use rowCount() To Get Number Of Rows From Pdo Result Using MySQL Database Table With Php .
I Use In This Tutorial:
- NetBeans IDE .
- XAMPP .
- PhpMyAdmin .
Php Source Code:
<?php
// PHP PDO Using Row Count
// get number of data in pdo result
try{
$pdoConnect = new PDO("mysql:host=localhost;dbname=test_db","root","");
} catch (PDOException $ex) {
echo $ex->getMessage();
exit();
}
$pdoQuery = "SELECT * FROM users";
$pdoResult = $pdoConnect->query($pdoQuery);
$pdoRowCount = $pdoResult->rowCount();
echo "<h1>$pdoRowCount</h1>";
///////////////OUTPUT: 16
Bagikan
Php : How To Use Pdo Row Count Php
4/
5
Oleh
insurance