Search
 
SCRIPT & CODE EXAMPLE
 

PHP

database, counts

// 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);
Comment

PREVIOUS NEXT
Code Example
Php :: magento 1.9 get all product 
Php :: PHP: How to remove specific element from an array? 
Php :: laravel eloquent get one column value 
Php :: laravel generate unique string 
Php :: laravel validation exists array 
Php :: php epoch conversion 
Php :: php check jwt token expired 
Php :: empty in php 
Php :: php send post request 
Php :: wordpress login user programmatically 
Php :: laravel pagination limit page 
Php :: php get duplicate keys in array without using inbuilt function 
Php :: php check if day in month 
Php :: display php error 
Php :: delay queue laravel 
Php :: laravel composer sanctum 
Php :: upgrade php version to 7.4 or higher 
Php :: laravel eloquent multiple join 
Php :: Laravel permission to Vuejs 
Php :: is legged in wodpress 
Php :: laravel migration tinyint length 
Php :: php variable inside mysql query 
Php :: Uncaught jquery-numerator requires jQuery to be loaded first wordpress 
Php :: laravel collection contains 
Php :: empty func php 
Php :: Regullar date format for php 
Php :: Uncaught Error: Call to undefined function add_submenu_page() 
Php :: stampare array php foreach 
Php :: single sign on php script 
Php :: html windows logo 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =