Is it possible to place PHP logic that connects to a database into HTMl?
For example, I have the following index.php
which has HTML in it however I will like to do the reverse where I have index.html
and have PHP in it.
For example, is it possible to place the following logic in my index.html
<?php
require 'vendor/autoload.php';
use PostgreSQLTutorial\Connection as Connection;
use PostgreSQLTutorial\CustomerDB as CustomerDB;
try {
$pdo = Connection::get()->connect();
// $pagenum = $_GET['pagenum'];
// $pagesize = $_GET['pagesize'];
// $start = $pagenum * $pagesize;
$customerDB = new CustomerDB($pdo);
$customers = $customerDB->findCustomer(10, 1);
$arr = json_decode($customers, true);
// echo $arr["TotalRows"];
} catch (\PDOException $e) {
echo $e->getMessage();
}
?>