Server : Apache System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64 User : apache ( 48) PHP Version : 8.0.28 Disable Function : NONE Directory : /var/www/html/mmishra/erp-10-07-2018/ |
<?php
try {
$db = new PDO("mysql:host=localhost;dbname=erp_core", 'erp', 'erpa2018', array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
} catch (PDOException $e) {
die("Error!: " . $e->getMessage());
}
$stmt = $db->prepare("INSERT INTO erp_core.erp_sqls(loginID, tableID, tupleID, sqlCommand) VAUES(?, ?, ?, ?)");
$stmt->execute(['aaa', 'vvv', 1, "zzz"]);
exit;
require_once "/var/www/html/erp/models/erp_model.php";
class aaaModel extends erpModel {
public $dbname = 'erp_aaa';
public function __construct() {
// mysql connection using PDO
$this->sqlStmt = "INSERT INTO erp_core.erp_sessions(sessionID,loginID,userIP,timeLogin) VALUES(?, ?, ?, ?)";
$this->dbstmt = $this->dbconn->prepare($this->sqlStmt);
try {
$this->dbconn->beginTransaction();
$this->dbstmt->execute([$sessionNo, $loginID, $userIP, date("Y-m-d H:i:s")]);
$this->dbconn->commit();
} catch(PDOExecption $e) {
$this->dbconn->rollback();
$this->dbError = "Error!: " . $e->getMessage();
}
}
public function __destruct() {
//print mysql_error();
$this->dbconn = null;
}
}
$aaaM = new aaaModel();
?>