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
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :