Step 1: Create MySQL Database Table

As we are going to cover this tutorial with example to create dynamic testimonial Bootstrap card with PHP and MySQL. So first we will create MySQL database table cards using below query.


CREATE TABLE `cards` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
`description` text NOT NULL,
`website` varchar(255) NOT NULL,
`image` varchar(255) NOT NULL,
`facebook` varchar(255) NOT NULL,
`gplus` varchar(255) NOT NULL,
`twitter` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Step 2: Create MySQL Database Connection In db_connect.php,

In db.php, we will create connection with MySQL database to get data to display in Bootstrap cards.

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "databasename";
$conn = mysqli_connect($servername, $username, $password, $dbname) or die("Connection failed: " . mysqli_connect_error());

Step 3: Get Data from MySQL Database Table and Create Bootstrap Cards

Now in index.php, we will get data from MySQL database table and display in Bootstrap cards for each records. We will use .card class to create basic card . The .card-header class used to add heading to the card and the .card-footer class to adds a footer to the card. We have also used custom CSS to design customized Bootstrap cards. you can get Bootstrap CSS from

https://getbootstrap.com/docs/5.2/getting-started/introduction/#cdn-links/