function __construct() { parent::__construct(); $this->factory = new Student_infoDomainFactory(); $this->selectStmt = self::$pdo->prepare("SELECT * FROM student_basic_information WHERE open_id=?"); $this->insertStmt = self::$pdo->prepare("INSERT INTO student_basic_information (open_id,student_id,name,idcard_num,educard_id,school,major,class,entrance_time) VALUES(?,?,?,?,?,?,?,?,?)"); $this->deleteStmt = self::$pdo->prepare("DELETE FROM student_basic_information WHERE open_id=?"); $this->updateStmt = self::$pdo->prepare("UPDATE student_basic_information set student_id=?,name=?,idcard_num=?,educard_id=?,school=?,major=?,class=?,entrance_time=? WHERE open_id=?"); $this->updateAllStmt = self::$pdo->prepare("UPDATE student_basic_information set student_id=?,name=?,idcard_num=?,educard_id=?,school=?,major=?,class=?,entrance_time=? WHERE open_id=?"); }
function __construct() { if (!isset(self::$pdo)) { try { // $dsn="mysql:dbname=afwdb;host=localhost;port=3306"; // $user="******"; // $password=""; $dsn = "mysql:dbname=afwdb;host=55bcb9ddc1a3f.sh.cdb.myqcloud.com;port=6055"; $user = "******"; $password = "******"; self::$pdo = new PDO($dsn, $user, $password); self::$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br/>"; die; } } }