set_charset('utf8mb4'); $dbh->query('CREATE DATABASE IF NOT EXISTS COMPANY_DB'); $dbh->select_db('COMPANY_DB'); $dbh->query('CREATE TABLE IF NOT EXISTS `SALARY` (`EMP_ID` INT PRIMARY KEY AUTO_INCREMENT, `EMP_NAME` VARCHAR(255), `BASIC_PAY` DOUBLE NOT NULL, `HRA` DOUBLE, `DA` DOUBLE, `PROFESSIONAL_TAX` DOUBLE)'); $result = $dbh->query('SELECT COUNT(*) AS count FROM `SALARY`'); $row = $result->fetch_assoc(); if ($row['count'] == 0) { $dbh->query('INSERT INTO `SALARY` (`EMP_NAME`, `BASIC_PAY`) VALUES ("Yu Jae-hoon", 70000), ("Meng Cilin", 65000), ("Mike Smith", 60000), ("Natsukashii Morimoto", 55000) '); } return $dbh; } function html_prologue($title) { ?>
Reason:
query('SELECT * FROM `SALARY`'); ?>Employee Name | Basic Pay | HRA | DA | Professional Tax |
---|---|---|---|---|
', $row['EMP_NAME'], ' | ', number_format(+$row['BASIC_PAY'], 2), ' | ', number_format(+$row['HRA'], 2), ' | ', number_format(+$row['DA'], 2), ' | ', number_format(+$row['PROFESSIONAL_TAX'], 2), ' |