База данных, счета
// With this php function you will be able to fetch all the number of items from a database table
// if this was helpful to you don't forget to follow
function showCon($pdo){
try {
$pdo= new PDO('mysql:host=localhost;dbname=database_name;charset=utf8','username','password');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo = $pdo->prepare("SELECT COUNT(*) FROM `database_table`");
$pdo->execute();
$row = $pdo->fetch();
return $row[0];
} catch (PDOException $e) {
echo "Fatal Error: " . $e->getMessage();
}
}
echo showCon($pdo);
Omo Junior